网站首页  词典首页

请输入您要查询的函数:

 

术语 createfilemappingnuma
释义 CreateFileMappingNuma
语法:
C++
HANDLE WINAPI CreateFileMappingNuma(
__in HANDLE hFile,
__in_opt LPSECURITY_ATTRIBUTES lpFileMappingAttributes,
__in DWORD flProtect,
__in DWORD dwMaximumSizeHigh,
__in DWORD dwMaximumSizeLow,
__in_opt LPCTSTR lpName,
__in DWORD nndPreferred
);
CreateFileMappingNuma功能
创建或打开一个有名或无名的文件指定文件映射对象,并指定为物理内存的NUMA节点。
参数
hFile [in]
句柄的文件中,创建一个文件映射对象。
该文件必须开放访问的权利与保护标志的flProtect参数指定兼容。它不是必需的,但建议的文件,您打算映射为独占访问打开。有关更多信息,请参阅文件安全性和访问权限。
如果hFile是INVALID_HANDLE_VALUE,调用进程也必须指定一个在dwMaximumSizeHigh和dwMaximumSizeLow参数文件映射对象的大小。在这种情况下,CreateFileMappingNuma创建一个指定大小,由系统分页文件的支持,而不是由一个在文件系统中文件的文件映射对象。
lpFileMappingAttributes [中,可选]
一个 SECURITY_ATTRIBUTES结构,决定是否返回的句柄可以被继承的子进程的指针。
如果lpFileMappingAttributes为NULL,则句柄不能被继承。
这个结构的lpSecurityDescriptor成员指定一个新的文件映射对象的安全描述符。如果lpFileMappingAttributes为NULL,则文件映射对象得到一个默认安全描述符。访问控制列表中的一个文件映射默认安全描述符(ACL)的对象是来自小学或模拟令牌的创造者。有关更多信息,请参阅文件映射安全和访问权限。
flProtect [in]
指定文件映射对象的页面保护。对象映射的所有意见必须符合这种保护。
此参数可以是下列值之一。
ValueMeaning
PAGE_EXECUTE_READAllows意见映射为读只,复制上写字,或执行访问。
文件句柄的hFile参数指定必须以GENERIC_READ和GENERIC_EXECUTE访问权限创建。
PAGE_EXECUTE_READWRITEAllows意见映射为读只,复制,上写,读/写或执行访问。
文件句柄的hFile参数指定要与GENERIC_READ,GENERIC_WRITE创建和GENERIC_EXECUTE访问权限。
PAGE_EXECUTE_WRITECOPYAllows意见映射为读只,复制上写字,或执行访问。此值等于PAGE_EXECUTE_READ。
文件句柄的hFile参数指定必须以GENERIC_READ和GENERIC_EXECUTE访问权限创建。
Windows Vista的:此值不带有SP1,直到Windows Vista中可用。
PAGE_READONLYAllows意见为读映射的或复制的写访问。试图写入访问冲突的特定区域的结果。
文件句柄的hFile参数指定,必须与GENERIC_READ访问权限创建。
PAGE_READWRITEAllows意见映射为读只,复制,上写,或读/写访问。
文件句柄的hFile参数指定必须以GENERIC_READ和GENERIC_WRITE访问权限创建。
PAGE_WRITECOPYAllows意见为读映射的或复制的写访问。此值等于PAGE_READONLY。
文件句柄的hFile参数指定,必须与GENERIC_READ访问权限创建。
一个应用程序可以指定相结合前面的页面保护价值逐一或该文件映射对象的下列属性。
ValueMeaning
SEC_COMMITAllocates物理存储在内存或所有网页的页面文件。
这是默认设置。
SEC_IMAGESets the file that is specified to be an executable image file.
由于地图资料和文件保护取自图像文件,没有其他属性与SEC_IMAGE有效。
SEC_LARGE_PAGESEnables大页面时使用的映射图像或从页面文件的支持,而不是常规文件时,地图数据。一定要指定为一个大页面的最小尺寸文件映射对象的最大尺寸报告了GetLargePageMinimum功能,使SeLockMemoryPrivilege特权。
SEC_NOCACHESets所有noncachable网页。
应用程序不应使用,除非明确的设备所需的这个标志。使用与SEC_NOCACHE映射内存的互锁功能可以导致EXCEPTION_ILLEGAL_INSTRUCTION例外。
SEC_NOCACHE要求要么SEC_RESERVE或SEC_COMMIT被设置。
不分配物理存储SEC_RESERVEReserves的所有网页。
保留的页面范围,不能使用到的页面范围释放任何其他分配操作。
页面可以保留在确定职能的VirtualAllocExNuma后续调用。此属性是有效的只有hFile参数INVALID_HANDLE_VALUE(即,一个文件映射对象,由系统分页文件备份)。
SEC_WRITECOMBINESets所有网页被写结合起来。
应用程序不应使用,除非明确的设备所需的此属性。使用内存映射与SEC_WRITECOMBINE可能会导致异常的EXCEPTION_ILLEGAL_INSTRUCTION互锁功能。
SEC_WRITECOMBINE,必须在SEC_RESERVE或SEC_COMMIT属性进行设置。
dwMaximumSizeHigh [in]
高阶双字节值对文件映射对象的最大尺寸。
dwMaximumSizeLow [in]
在低位双字节值对文件映射对象的最大尺寸。
如果此参数和dwMaximumSizeHigh参数为0(零),该文件映射对象的最大大小等于该文件的hFile参数确定的当前大小。
试图映射的长度为0(零)文件失败的ERROR_FILE_INVALID错误代码。应该测试应用程序的文件的长度为0(零)和拒绝这些文件。
lpName [中,可选]
该文件映射对象的名称。
如果此参数匹配的现有文件映射对象的名称,功能请求访问与保护的flProtect参数指定对象。
如果该参数为NULL,则文件映射对象被创建没有名称。
如果lpName参数匹配现有的事件,信号量,互斥体,可等待定时器,或工作对象的名称,函数失败并GetLastError函数返回出现ERROR_INVALID_HANDLE。这是因为这些对象共享相同的命名空间。
终端服务:名称可以有一个“全球\\”或“Local \\”前缀明确创建对象的全局或会话命名空间。名称的其余部分可以包含以外的任何字符反斜杠字符(\\)。创建一个全局命名空间中的文件映射对象需要SeCreateGlobalPrivilege特权。如需信息见命名内核对象。
快速用户切换是通过使用终端服务会话。第一个用户对使用记录会话0(零),下次用户登录使用会话1(一),等等。内核对象名称必须按照概述为终端服务,使应用程序能够支持多个用户指南。
nndPreferred [in]
在NUMA节点在物理内存应该驻留。
返回值
如果函数成功,返回值是一个句柄文件映射对象。
如果该对象在函数调用之前存在,函数返回的句柄现有的对象(其目前的规模,而不是指定的大小)和GetLastError函数返回ERROR_ALREADY_EXISTS。
如果函数失败,返回值为NULL。为了获得更多错误信息,调用GetLastError函数。
备注
后一个文件映射对象被创建时,文件的大小不得超过该文件映射对象的大小,如果不,不是文件的内容都可以共享。
该文件映射对象可以共享的重复,继承,或名称。在一个文件映射的网页内容对象的初始页面文件的支持是0(零)。
如果应用程序指定一个文件映射对象大于实际命名的磁盘上的文件大小,如果页面保护允许写访问(即flProtect参数指定PAGE_READWRITE或PAGE_EXECUTE_READWRITE),然后在磁盘上的文件的大小增加匹配的文件映射对象指定的大小。如果该文件的延长,之间的文件的旧的结束和新的档案文件的末尾的内容不能保证为零;的行为是由文件系统定义。
如果该文件不能增加,结果是失败的创建文件映射对象和GetLastError函数返回ERROR_DISK_FULL。
该处理CreateFileMappingNuma函数返回完全访问到一个新的文件映射对象,可与任何函数,需要处理的文件映射对象使用。文件映射对象可以通过共享进程创建,处理重复,或名称。有关更多信息,请参阅DuplicateHandle和OpenFileMapping功能。
创建一个文件映射对象创建映射文件的一个观点的潜力,但不映射的观点。该MapViewOfFileExNuma函数映射一个文件能够成为一个进程的地址空间。
一个重要的例外,文件从一个文件映射对象的意见是一致得出相同或在特定时间。如果多个进程处理同一文件映射对象,他们看到的数据一致的看法时,映射文件的看法。
唯一的例外是有关远程文件。虽然与远程文件CreateFileMappingNuma功能的作品,它不会让他们一致的。例如,如果两台计算机都映射一个可写的,都改变同一页的文件,每一台计算机上只能看到自己写的网页。当数据在磁盘上得到更新,页面将不会被合并。
阿映射文件和通过使用输入和输出(I / O)的功能(ReadFile和WriteFile)访问的文件不一定是一致的。
要完全关闭文件映射对象,应用程序必须取消映射通过调用UnmapViewOfFile函数的文件映射对象映射的所有意见,然后关闭该文件映射对象句柄通过调用CloseHandle函数。
这些函数可以调用任何顺序排列。到UnmapViewOfFile函数调用是必要的,因为映射文件映射对象的意见,保持内部打开句柄的对象和一个文件映射对象不关闭所有打开的句柄,直到它被关闭。
创建一个文件映射从会话会话零比其他对象需要SeCreateGlobalPrivilege特权。请注意,此特权检查仅限于文件映射对象的创建,不适用于现有的开放。例如,如果一个服务或系统创建一个文件映射对象,任何进程在任何会话中运行的可以访问该文件映射对象提供来电者具有所需的访问权限。
使用结构化异常处理,以保护任何代码写入或映射查看内存中读取。有关详细信息,请阅读并从文件视图写作。
有一个具有执行权限的映射,应用程序必须调用要么PAGE_EXECUTE_READWRITE或PAGE_EXECUTE_READ,然后CreateFileMappingNuma函数调用FILE_MAP_EXECUTE的MapViewOfFileExNuma职能| FILE_MAP_WRITE或FILE_MAP_EXECUTE | FILE_MAP_READ。
要求:
client最低支持Vista
server最低支持 Windows Server 2008
HeaderWinbase.h
LibraryKernel32.lib
DLLKernel32.dll
Unicode和ANSI namesCreateFileMappingNumaW(Unicode)和CreateFileMappingNumaA(ANSI)的
参见
CloseHandle
CreateFileMapping
DuplicateHandle
文件映射函数
MapViewOfFileExNuma
NUMA支持
OpenFileMapping
ReadFile
SECURITY_ATTRIBUTES
UnmapViewOfFile
VirtualAllocExNuma
WriteFile
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==CreateFileMappingNuma Function
Creates or opens a named or unnamed file mapping object for a specified file and specifies the NUMA node for the physical memory.
Syntax
C++
HANDLE WINAPI CreateFileMappingNuma(
__in HANDLE hFile,
__in_opt LPSECURITY_ATTRIBUTES lpFileMappingAttributes,
__in DWORD flProtect,
__in DWORD dwMaximumSizeHigh,
__in DWORD dwMaximumSizeLow,
__in_opt LPCTSTR lpName,
__in DWORD nndPreferred
);
Parameters
hFile [in]
A handle to the file from which to create a file mapping object.
The file must be opened with access rights that are compatible with the protection flags that the flProtect parameter specifies. It is not required, but it is recommended that files you intend to map be opened for exclusive access. For more information, see File Security and Access Rights .
If hFile is INVALID_HANDLE_VALUE, the calling process must also specify a size for the file mapping object in the dwMaximumSizeHigh and dwMaximumSizeLow parameters. In this scenario, CreateFileMappingNuma creates a file mapping object of a specified size that is backed by the system paging file instead of by a file in the file system.
lpFileMappingAttributes [in, optional]
A pointer to a SECURITY_ATTRIBUTES structure that determines whether a returned handle can be inherited by child processes.
If lpFileMappingAttributes is NULL, the handle cannot be inherited.
The lpSecurityDescriptor member of this structure specifies a security descriptor for a new file mapping object. If lpFileMappingAttributes is NULL, the file mapping object gets a default security descriptor. The access control lists (ACL) in the default security descriptor for a file mapping object come from the primary or impersonation token of the creator. For more information, see File Mapping Security and Access Rights .
flProtect [in]
Specifies the page protection of the file mapping object. All mapped views of the object must be compatible with this protection.
This parameter can be one of the following values.
ValueMeaning
PAGE_EXECUTE_READAllows views to be mapped for read-only, copy-on-write, or execute access.
The file handle that the hFile parameter specifies must be created with the GENERIC_READ and GENERIC_EXECUTE access rights.
PAGE_EXECUTE_READWRITEAllows views to be mapped for read-only, copy-on-write, read/write or execute access.
The file handle that the hFile parameter specifies must be created with the GENERIC_READ, GENERIC_WRITE, and GENERIC_EXECUTE access rights.
PAGE_EXECUTE_WRITECOPYAllows views to be mapped for read-only, copy-on-write, or execute access. This value is equivalent to PAGE_EXECUTE_READ.
The file handle that the hFile parameter specifies must be created with the GENERIC_READ and GENERIC_EXECUTE access rights.
Windows Vista: This value is not available until Windows Vista with SP1.
PAGE_READONLYAllows views to be mapped for read-only or copy-on-write access. An attempt to write to a specific region results in an access violation.
The file handle that the hFile parameter specifies must be created with the GENERIC_READ access right.
PAGE_READWRITEAllows views to be mapped for read-only, copy-on-write, or read/write access.
The file handle that the hFile parameter specifies must be created with the GENERIC_READ and GENERIC_WRITE access rights.
PAGE_WRITECOPYAllows views to be mapped for read-only or copy-on-write access. This value is equivalent to PAGE_READONLY.
The file handle that the hFile parameter specifies must be created with the GENERIC_READ access right.

An application can specify one or more of the following attributes for the file mapping object by combining them with one of the preceding page protection values.
ValueMeaning
SEC_COMMITAllocates physical storage in memory or the paging file for all pages.
This is the default setting.
SEC_IMAGESets the file that is specified to be an executable image file.
Because the mapping information and file protection are taken from the image file, no other attributes are valid with SEC_IMAGE.
SEC_LARGE_PAGESEnables large pages to be used when mapping images or backing from the pagefile, but not when mapping data for regular files. Be sure to specify the maximum size of the file mapping object as the minimum size of a large page reported by the GetLargePageMinimum function and to enable the SeLockMemoryPrivilege privilege.
SEC_NOCACHESets all pages to noncachable.
Applications should not use this flag except when explicitly required for a device. Using the interlocked functions with memory mapped with SEC_NOCACHE can result in an EXCEPTION_ILLEGAL_INSTRUCTION exception.
SEC_NOCACHE requires either SEC_RESERVE or SEC_COMMIT to be set.
SEC_RESERVEReserves all pages without allocating physical storage.
The reserved range of pages cannot be used by any other allocation operations until the range of pages is released.
Reserved pages can be identified in subsequent calls to the VirtualAllocExNuma function. This attribute is valid only if the hFile parameter is INVALID_HANDLE_VALUE (that is, a file mapping object that is backed by the system paging file).
SEC_WRITECOMBINESets all pages to be write-combined.
Applications should not use this attribute except when explicitly required for a device. Using the interlocked functions with memory that is mapped with SEC_WRITECOMBINE can result in an EXCEPTION_ILLEGAL_INSTRUCTION exception.
SEC_WRITECOMBINE requires either the SEC_RESERVE or SEC_COMMIT attribute to be set.

dwMaximumSizeHigh [in]
The high-order DWORD of the maximum size of the file mapping object.
dwMaximumSizeLow [in]
The low-order DWORD of the maximum size of the file mapping object.
If this parameter and the dwMaximumSizeHigh parameter are 0 (zero), the maximum size of the file mapping object is equal to the current size of the file that the hFile parameter identifies.
An attempt to map a file with a length of 0 (zero) fails with an error code of ERROR_FILE_INVALID. Applications should test for files with a length of 0 (zero) and reject those files.
lpName [in, optional]
The name of the file mapping object.
If this parameter matches the name of an existing file mapping object, the function requests access to the object with the protection that the flProtect parameter specifies.
If this parameter is NULL, the file mapping object is created without a name.
If the lpName parameter matches the name of an existing event, semaphore, mutex, waitable timer, or job object, the function fails and the GetLastError function returns ERROR_INVALID_HANDLE. This occurs because these objects share the same namespace.
Terminal Services: The name can have a "Global\\" or "Local\\" prefix to explicitly create the object in the global or session namespace. The remainder of the name can contain any character except the backslash character (\\). Creating a file mapping object in the global namespace requires the SeCreateGlobalPrivilege privilege. For more information, see Kernel Object Namespaces .
Fast user switching is implemented by using Terminal Services sessions. The first user to log on uses session 0 (zero), the next user to log on uses session 1 (one), and so on. Kernel object names must follow the guidelines that are outlined for Terminal Services so that applications can support multiple users.
nndPreferred [in]
The NUMA node where the physical memory should reside.
Return Value
If the function succeeds, the return value is a handle to the file mapping object.
If the object exists before the function call, the function returns a handle to the existing object (with its current size, not the specified size) and the GetLastError function returns ERROR_ALREADY_EXISTS.
If the function fails, the return value is NULL. To get extended error information, call the GetLastError function.
Remarks
After a file mapping object is created, the size of the file must not exceed the size of the file mapping object; if it does, not all of the file contents are available for sharing.
The file mapping object can be shared by duplication, inheritance, or by name. The initial contents of the pages in a file mapping object backed by the page file are 0 (zero).
If an application specifies a size for the file mapping object that is larger than the size of the actual named file on disk and if the page protection allows write access (that is, the flProtect parameter specifies PAGE_READWRITE or PAGE_EXECUTE_READWRITE), then the file on disk is increased to match the specified size of the file mapping object. If the file is extended, the contents of the file between the old end of the file and the new end of the file are not guaranteed to be zero; the behavior is defined by the file system.
If the file cannot be increased, the result is a failure to create the file mapping object and the GetLastError function returns ERROR_DISK_FULL.
The handle that the CreateFileMappingNuma function returns has full access to a new file mapping object and can be used with any function that requires a handle to a file mapping object. A file mapping object can be shared through process creation, handle duplication, or by name. For more information, see the DuplicateHandle and OpenFileMapping functions.
Creating a file mapping object creates the potential for mapping a view of the file but does not map the view. The MapViewOfFileExNuma function maps a view of a file into a process address space.
With one important exception, file views derived from a single file mapping object are coherent or identical at a specific time. If multiple processes have handles of the same file mapping object, they see a coherent view of the data when they map a view of the file.
The exception is related to remote files. Although the CreateFileMappingNuma function works with remote files, it does not keep them coherent. For example, if two computers both map a file as writable and both change the same page, each computer sees only its own writes to the page. When the data gets updated on the disk, the page is not merged.
A mapped file and a file that is accessed by using the input and output (I/O) functions ( ReadFile and WriteFile ) are not necessarily coherent.
To fully close a file mapping object, an application must unmap all mapped views of the file mapping object by calling the UnmapViewOfFile function and then close the file mapping object handle by calling the CloseHandle function.
These functions can be called in any order. The call to the UnmapViewOfFile function is necessary, because mapped views of a file mapping object maintain internal open handles to the object, and a file mapping object does not close until all open handles to it are closed.
Creating a file-mapping object from a session other than session zero requires the SeCreateGlobalPrivilege privilege. Note that this privilege check is limited to the creation of file mapping objects and does not apply to opening existing ones. For example, if a service or the system creates a file mapping object, any process running in any session can access that file mapping object provided that the caller has the required access rights.
Use structured exception handling to protect any code that writes to or reads from a memory mapped view. For more information, see Reading and Writing From a File View .
To have a mapping with executable permissions, an application must call the CreateFileMappingNuma function with either PAGE_EXECUTE_READWRITE or PAGE_EXECUTE_READ and then call the MapViewOfFileExNuma function with FILE_MAP_EXECUTE | FILE_MAP_WRITE or FILE_MAP_EXECUTE | FILE_MAP_READ.
Requirements
Minimum supported clientWindows Vista
Minimum supported serverWindows Server 2008
HeaderWinbase.h
LibraryKernel32.lib
DLLKernel32.dll
Unicode and ANSI namesCreateFileMappingNumaW (Unicode) and CreateFileMappingNumaA (ANSI)
See Also
CloseHandle
CreateFileMapping
DuplicateHandle
File Mapping Functions
MapViewOfFileExNuma
NUMA Support
OpenFileMapping
ReadFile
SECURITY_ATTRIBUTES
UnmapViewOfFile
VirtualAllocExNuma
WriteFile
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa366539(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:21:44