MapViewOfFile Operate (Memoryapi.h)
페이지 정보

본문
Maps a view of a file mapping into the tackle house of a calling course of. To specify a advised base handle for the view, use the MapViewOfFileEx function. However, this practice is just not recommended. 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 safety of the pages. This parameter could be one in every of the next values, or a bitwise OR mixture of a number of values the place applicable. Using bitwise OR, you possibly can combine the values above with these values. When a process writes to a duplicate-on-write page, the system copies the unique page to a new page that is non-public to the method. The brand new web page is backed by the paging file. The safety of the brand new page changes from copy-on-write to read/write. When copy-on-write access is specified, the system and process commit charge taken is for all the view because the calling process can potentially write to each page in the view, making all pages private.
The contents of the brand new page are never written again to the original file and are lost when the view is unmapped. Home windows Server 2003 and Home windows XP: This value is available beginning with Home windows XP with SP2 and Home windows Server 2003 with SP1. For more information about access to file mapping objects, see File Mapping Safety and Access Rights. A excessive-order DWORD of the file offset where the view begins. A low-order DWORD of the file offset the place the view is to begin. The mixture of the excessive and low offsets should specify an offset throughout the file mapping. They must additionally match the virtual Memory Wave allocation granularity of the system. That's, the offset should 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 inside the maximum size specified by CreateFileMapping. If this parameter is 0 (zero), the mapping extends from the required offset to the tip of the file mapping.
If the operate succeeds, the return worth is the starting address of the mapped view. If the perform fails, the return worth is NULL. To get extended error information, name GetLastError. Mapping a file makes the specified portion of a file seen within the address area of the calling course of. For recordsdata which can be larger than the address house, you may only map a small portion of the file data at one time. When the first view is full, you'll be able to unmap it and map a brand new view. To acquire the dimensions of a view, use the VirtualQuery function. Multiple views of a file (or a file mapping object and its mapped file) are coherent in the event that they include equivalent information at a specified time. This happens if the file views are derived from any file mapping object that's backed by the identical file. A process can duplicate a file mapping object handle into another process through the use of the DuplicateHandle perform, or another process can open a file mapping object by name by using the OpenFileMapping function.
With one essential exception, file views derived from any file mapping object that is backed by the same file are coherent or identical at a selected time. Coherency is assured for views inside a course of and for views which are mapped by different processes. The exception is said to distant recordsdata. Although MapViewOfFile works with distant recordsdata, it doesn't keep them coherent. For example, if two computers each map a file as writable, and both change the identical web page, every computer only sees its personal writes to the web page. When the info will get updated on the disk, it isn't merged. A mapped view of a file will not be assured to be coherent with a file that's being accessed by the ReadFile or WriteFile function. Don't retailer pointers in the memory mapped file; store offsets from the base of the file mapping in order that the mapping can be used at any address. ERROR exceptions, use structured exception handling to guard any code that writes to or reads from a Memory Wave clarity support mapped view of a file apart from the web page file. For extra data, see Reading and Writing From a File View. When modifying a file via a mapped view, the final modification timestamp may not be updated routinely. If required, the caller should use SetFileTime to set the timestamp. Value), the paging file have to be massive enough to hold all the mapping. If it's not, Memory Wave MapViewOfFile fails. The initial contents of the pages in a file mapping object backed by the paging file are zero (zero). RESERVE). Mapping the file makes your entire mapped virtual deal with vary unavailable to other allocations in the method. After a page from the reserved vary is committed, it cannot be freed or decommitted by calling VirtualFree. Reserved and dedicated pages are released when the view is unmapped and the file mapping object is closed. For particulars, see the UnmapViewOfFile and CloseHandle functions.
- 이전글Four Shortcuts For Live Poker Online That Gets Your Lead to Record Time 25.08.14
- 다음글3 Ways to Guard Against Poker Real Money 25.08.14
댓글목록
등록된 댓글이 없습니다.