MapViewOfFile Perform (Memoryapi.h)
페이지 정보
작성자 Giuseppe 작성일25-08-13 03:13 조회35회 댓글0건관련링크
본문
Maps a view of a file mapping into the deal with area of a calling process. To specify a prompt base tackle for the view, use the MapViewOfFileEx operate. However, this apply will not be really useful. A handle to a file mapping object. The CreateFileMapping and OpenFileMapping functions return this handle. The type of entry to a file mapping object, which determines the page protection of the pages. This parameter might be one in every of the next values, or a bitwise OR mixture of multiple values where applicable. Utilizing bitwise OR, you possibly can mix the values above with these values. When a process writes to a replica-on-write web page, the system copies the unique web page to a new page that's personal to the process. The new web page is backed by the paging file. The protection of the brand new web page changes from copy-on-write to read/write. When copy-on-write entry is specified, the system and course of commit charge taken is for the entire view because the calling course of can doubtlessly write to every page within the view, making all pages private.

The contents of the new web page are by no means written back to the unique file and are lost when the view is unmapped. Windows Server 2003 and Windows XP: This value is on the market beginning with Home windows XP with SP2 and Windows Server 2003 with SP1. For extra details about entry to file mapping objects, see File Mapping Security and Access Rights. A high-order DWORD of the file offset where the view begins. A low-order DWORD of the file offset where the view is to start. The mix of the excessive and low offsets should specify an offset inside the file mapping. They must additionally match the digital memory allocation granularity of the system. That is, the offset have to be a a number of of the VirtualAlloc allocation granularity. The number of bytes of a file mapping to map to the view. All bytes have to be within the maximum dimension specified by CreateFileMapping. If this parameter is 0 (zero), the mapping extends from the desired offset to the end of the file mapping.
If the operate succeeds, the return value is the starting tackle of the mapped view. If the operate fails, the return worth is NULL. To get extended error data, call GetLastError. Mapping a file makes the specified portion of a file visible in the address house of the calling process. For files that are bigger than the address house, you possibly can only map a small portion of the file knowledge at one time. When the primary view is complete, you can unmap it and map a new view. To acquire the scale of a view, use the VirtualQuery function. Multiple views of a file (or neural entrainment audio a file mapping object and its mapped file) are coherent if they include an identical knowledge at a specified time. This happens if the file views are derived from any file mapping object that's backed by the same file. A course of can duplicate a file mapping object handle into another course of by using the DuplicateHandle operate, or another course of can open a file mapping object by title by utilizing the OpenFileMapping function.
With one important exception, file views derived from any file mapping object that is backed by the same file are coherent or similar at a particular time. Coherency is guaranteed for views within a process and for views which might be mapped by totally different processes. The exception is related to remote files. Though MapViewOfFile works with distant recordsdata, it doesn't keep them coherent. For example, if two computers each map a file as writable, and each change the identical web page, every pc only sees its personal writes to the page. When the info will get up to date on the disk, it isn't merged. A mapped view of a file shouldn't be guaranteed to be coherent with a file that's being accessed by the ReadFile or WriteFile operate. Don't retailer pointers within the Memory Wave mapped file; retailer offsets from the base of the file mapping in order that the mapping can be used at any deal with. ERROR exceptions, use structured exception dealing with to protect any code that writes to or reads from a Memory Wave mapped view of a file other than the web page file. For more data, see Studying and Writing From a File View. When modifying a file by means of a mapped view, the last modification timestamp is probably not up to date robotically. If required, the caller should use SetFileTime to set the timestamp. Worth), the paging file have to be large enough to carry the entire mapping. If it isn't, neural entrainment audio MapViewOfFile fails. The initial contents of the pages in a file mapping object backed by the paging file are 0 (zero). RESERVE). Mapping the file makes your complete mapped virtual address vary unavailable to different allocations in the method. After a page from the reserved range is committed, it cannot be freed or decommitted by calling VirtualFree. Reserved and committed pages are launched when the view is unmapped and the file mapping object is closed. For details, see the UnmapViewOfFile and CloseHandle capabilities.
댓글목록
등록된 댓글이 없습니다.
