@@ -31,12 +31,13 @@ use windows::Win32::Foundation::{CloseHandle, HANDLE, INVALID_HANDLE_VALUE};
3131use windows:: Win32 :: System :: Memory :: PAGE_READWRITE ;
3232#[ cfg( target_os = "windows" ) ]
3333use windows:: Win32 :: System :: Memory :: {
34- CreateFileMappingA , FILE_MAP_ALL_ACCESS , MEM_PRESERVE_PLACEHOLDER , MEM_RELEASE ,
35- MEM_REPLACE_PLACEHOLDER , MEM_RESERVE , MEM_RESERVE_PLACEHOLDER , MEMORY_MAPPED_VIEW_ADDRESS ,
36- MapViewOfFile , MapViewOfFile3 , PAGE_NOACCESS , PAGE_PROTECTION_FLAGS , PAGE_READONLY ,
37- UnmapViewOfFile , VIRTUAL_ALLOCATION_TYPE , VIRTUAL_FREE_TYPE , VirtualAlloc2 , VirtualFree ,
38- VirtualProtect ,
34+ CreateFileMappingA , MEM_PRESERVE_PLACEHOLDER , MEM_RELEASE , MEM_REPLACE_PLACEHOLDER ,
35+ MEM_RESERVE , MEM_RESERVE_PLACEHOLDER , MEMORY_MAPPED_VIEW_ADDRESS , MapViewOfFile3 ,
36+ PAGE_NOACCESS , PAGE_PROTECTION_FLAGS , PAGE_READONLY , UnmapViewOfFile , VIRTUAL_ALLOCATION_TYPE ,
37+ VIRTUAL_FREE_TYPE , VirtualAlloc2 , VirtualFree , VirtualProtect ,
3938} ;
39+ #[ cfg( all( target_os = "windows" , not( feature = "whp-no-surrogate" ) ) ) ]
40+ use windows:: Win32 :: System :: Memory :: { FILE_MAP_ALL_ACCESS , MapViewOfFile } ;
4041#[ cfg( all( target_os = "windows" , feature = "whp-no-surrogate" ) ) ]
4142use windows:: Win32 :: System :: Memory :: { MEM_COMMIT , VirtualAlloc } ;
4243#[ cfg( target_os = "windows" ) ]
@@ -117,6 +118,7 @@ enum WindowsMapping {
117118 /// |<------------------ view ------------------>|
118119 /// [ guard ][ blob ][ guard ]
119120 /// ```
121+ #[ cfg( not( feature = "whp-no-surrogate" ) ) ]
120122 Anonymous {
121123 view : MappedView ,
122124 file_mapping : FileMapping ,
@@ -151,6 +153,7 @@ impl HostMapping {
151153 }
152154 #[ cfg( target_os = "windows" ) ]
153155 match & self . mapping {
156+ #[ cfg( not( feature = "whp-no-surrogate" ) ) ]
154157 WindowsMapping :: Anonymous { view, .. } => view. addr as * mut u8 ,
155158 WindowsMapping :: FileBacked { leading, .. } => leading. addr as * mut u8 ,
156159 #[ cfg( feature = "whp-no-surrogate" ) ]
@@ -166,6 +169,7 @@ impl HostMapping {
166169 }
167170 #[ cfg( target_os = "windows" ) ]
168171 match & self . mapping {
172+ #[ cfg( not( feature = "whp-no-surrogate" ) ) ]
169173 WindowsMapping :: Anonymous { view, .. } => view. len ,
170174 WindowsMapping :: FileBacked {
171175 leading,
@@ -182,8 +186,9 @@ impl HostMapping {
182186 #[ cfg( target_os = "windows" ) ]
183187 pub ( crate ) fn file_mapping_handle ( & self ) -> HANDLE {
184188 match & self . mapping {
185- WindowsMapping :: Anonymous { file_mapping, .. }
186- | WindowsMapping :: FileBacked { file_mapping, .. } => file_mapping. 0 ,
189+ #[ cfg( not( feature = "whp-no-surrogate" ) ) ]
190+ WindowsMapping :: Anonymous { file_mapping, .. } => file_mapping. 0 ,
191+ WindowsMapping :: FileBacked { file_mapping, .. } => file_mapping. 0 ,
187192 #[ cfg( feature = "whp-no-surrogate" ) ]
188193 WindowsMapping :: DirectAlloc ( _) => INVALID_HANDLE_VALUE ,
189194 }
@@ -1800,6 +1805,7 @@ impl SharedMemory for ReadonlySharedMemory {
18001805 #[ cfg( windows) ]
18011806 fn host_region_base ( & self ) -> <HostGuestMemoryRegion as MemoryRegionKind >:: HostBaseType {
18021807 match & self . region ( ) . mapping {
1808+ #[ cfg( not( feature = "whp-no-surrogate" ) ) ]
18031809 WindowsMapping :: Anonymous { .. } => super :: memory_region:: HostRegionBase {
18041810 from_handle : self . region ( ) . file_mapping_handle ( ) . into ( ) ,
18051811 handle_base : self . region ( ) . ptr ( ) as usize ,
0 commit comments