Tom.Cat
禁止发言
禁止发言
  • 注册日期2001-10-10
  • 最后登录2019-07-29
  • 粉丝1
  • 关注0
  • 积分-53792分
  • 威望197411点
  • 贡献值0点
  • 好评度5点
  • 原创分0分
  • 专家分0分
  • 社区居民
阅读:2495回复:10

谁用过ZwCreateSection

楼主#
更多 发布于:2004-08-12 22:39
用户被禁言,该主题自动屏蔽!
wowocock
VIP专家组
VIP专家组
  • 注册日期2002-04-08
  • 最后登录2016-01-09
  • 粉丝16
  • 关注2
  • 积分601分
  • 威望1651点
  • 贡献值1点
  • 好评度1227点
  • 原创分1分
  • 专家分0分
沙发#
发布于:2004-08-12 23:13
ZwCreateSection
The ZwCreateSection routine creates a section object and returns a section object handle with the specified desired access.

NTSTATUS
  ZwCreateSection(
    OUT PHANDLE  SectionHandle,
    IN ACCESS_MASK  DesiredAccess,
    IN POBJECT_ATTRIBUTES  ObjectAttributes OPTIONAL,
    IN PLARGE_INTEGER  MaximumSize OPTIONAL,
    IN ULONG  SectionPageProtection,
    IN ULONG  AllocationAttributes,
    IN HANDLE  FileHandle OPTIONAL
    );
Parameters
SectionHandle
Pointer to a variable that will receive the section object handle if this call is successful.
DesiredAccess
Specifies the ACCESS_MASK value that expresses the requested access to the section object. The system-defined set of DesiredAccess flags defines the following specific access rights for section objects. Flag Meaning
SECTION_EXTEND_SIZE The size of the section can be dynamically extended.  
SECTION_MAP_EXECUTE Views of this section are executable.
SECTION_MAP_READ Views of this section are readable.
SECTION_MAP_WRITE Views of this section are writeable.
SECTION_QUERY The section object can be queried for information about the section. Drivers should set this bit.  
SECTION_ALL_ACCESS All of the above flags ORed with the system-defined STANDARD_RIGHTS_REQUIRED.


ObjectAttributes
Pointer to a structure that contains the attributes of the section to be opened. The structure was previously initialized by calling InitializeObjectAttributes. If the caller is running in the system process context, this parameter can be NULL. Otherwise, the caller must set the OBJ_KERNEL_HANDLE attribute in the call to InitializeObjectAttributes.
MaximumSize
Specifies the maximum size, in bytes, of the section. This value is rounded up by ZwCreateSection to the nearest multiple of PAGE_SIZE. If the section is backed by the paging file, MaximumSize specifies the actual size of the section. If the section is backed by an ordinary file, MaximumSize specifies the maximum size to which the file can be extended or mapped.
SectionPageProtection
Specifies the protection to place on each page in the section. Specify one of the following: PAGE_READONLY, PAGE_READWRITE, PAGE_EXECUTE, or PAGE_WRITECOPY. For a description of each PAGE_XXX value, see the CreateFileMapping routine in the Platform SDK.
AllocationAttributes
Specifies a bitmask of SEC_XXX flags that determine the allocation attributes of the section. For a description of the possible SEC_XXX flags, see the documentation of the CreateFileMapping routine in the Platform SDK.
FileHandle
Optionally specifies a handle for an open file object. If the value of FileHandle is NULL, the section is backed by the paging file. Otherwise the section is backed by the specified file.
Headers
Declared in ntddk.h. Include ntddk.h.

Return Value
ZwCreateSection returns STATUS_SUCCESS on success, or the appropriate error code on failure. Possible error status codes include the following:

STATUS_FILE_LOCK_CONFLICT
The file specified by the FileObject parameter is locked.
STATUS_INVALID_FILE_FOR_SECTION
The file specified by FileObject does not support sections.
STATUS_INVALID_PAGE_PROTECTION
The value specified for the SectionPageProtection parameter is invalid.
STATUS_MAPPED_FILE_SIZE_ZERO
The size of the file specified by FileObject is zero, and MaximumSize is zero.
STATUS_SECTION_TOO_BIG
The value of MaximumSize is too big. This occurs when either MaximumSize is greater than the system-defined maximum for sections, or if MaximumSize is greater than the specified file and the section is not writeable.
Comments
Any handle that is obtained from ZwCreateSection must eventually be released by calling ZwClose.

Driver routines that run in a process context other than that of the system process must set the OBJ_KERNEL_HANDLE attribute for the ObjectAttributes parameter of ZwCreateSection. This restricts the use of the handle returned by ZwCreateSection to processes that are running in kernel mode. Otherwise, the handle can be accessed by the process in whose context the driver is running.

For more information on setting up mapped sections and views of memory, see Sections and Views.

Callers of ZwCreateSection must be running at IRQL = PASSIVE_LEVEL.

See Also
ACCESS_MASK, InitializeObjectAttributes, ZwClose, ZwMapViewOfSection, ZwOpenSection, ZwUnmapViewOfSection

Built on Friday, April 11, 2003
花开了,然后又会凋零,星星是璀璨的,可那光芒也会消失。在这样 一瞬间,人降生了,笑者,哭着,战斗,伤害,喜悦,悲伤憎恶,爱。一切都只是刹那间的邂逅,而最后都要归入死亡的永眠
Tom.Cat
禁止发言
禁止发言
  • 注册日期2001-10-10
  • 最后登录2019-07-29
  • 粉丝1
  • 关注0
  • 积分-53792分
  • 威望197411点
  • 贡献值0点
  • 好评度5点
  • 原创分0分
  • 专家分0分
  • 社区居民
板凳#
发布于:2004-08-12 23:42
用户被禁言,该主题自动屏蔽!
AllenZh
驱动老牛
驱动老牛
  • 注册日期2001-08-19
  • 最后登录2015-11-27
  • 粉丝19
  • 关注10
  • 积分1316分
  • 威望2387点
  • 贡献值7点
  • 好评度321点
  • 原创分0分
  • 专家分0分
地板#
发布于:2004-08-13 09:30
wowocock你用过吗?
ntddk.h中没有声明啊。

以前我用过
你需要将他的声明加入你的工程中就OK了
1,承接Windows下驱动/应用开发 2,本人原创虚拟鼠标/键盘,触摸屏,虚拟显卡,Mirror驱动,XP无盘的SCSI虚拟磁盘驱动等 3,windows下有尝技术服务(包括BUG调试,员工培训等) 欢迎深圳和海外企业联系.msn:mfczmh@sina.com
Tom.Cat
禁止发言
禁止发言
  • 注册日期2001-10-10
  • 最后登录2019-07-29
  • 粉丝1
  • 关注0
  • 积分-53792分
  • 威望197411点
  • 贡献值0点
  • 好评度5点
  • 原创分0分
  • 专家分0分
  • 社区居民
地下室#
发布于:2004-08-13 10:43
用户被禁言,该主题自动屏蔽!
arthurtu
驱动巨牛
驱动巨牛
  • 注册日期2001-11-08
  • 最后登录2020-12-19
  • 粉丝0
  • 关注0
  • 积分26分
  • 威望161点
  • 贡献值0点
  • 好评度35点
  • 原创分0分
  • 专家分0分
  • 社区居民
5楼#
发布于:2004-08-13 10:55
1、好像你的文件名是cpp?那么加上extern “C” ZwCrea。。。
2、没有加ntoskrnl.lib ?
Tom.Cat
禁止发言
禁止发言
  • 注册日期2001-10-10
  • 最后登录2019-07-29
  • 粉丝1
  • 关注0
  • 积分-53792分
  • 威望197411点
  • 贡献值0点
  • 好评度5点
  • 原创分0分
  • 专家分0分
  • 社区居民
6楼#
发布于:2004-08-13 11:12
用户被禁言,该主题自动屏蔽!
wowocock
VIP专家组
VIP专家组
  • 注册日期2002-04-08
  • 最后登录2016-01-09
  • 粉丝16
  • 关注2
  • 积分601分
  • 威望1651点
  • 贡献值1点
  • 好评度1227点
  • 原创分1分
  • 专家分0分
7楼#
发布于:2004-08-13 11:35
养成良好的习惯,在所有CPP中使用的非重载函数全部用EXTERN "C"省的编译器自作主张的帮你乱起名字,嘿嘿......
花开了,然后又会凋零,星星是璀璨的,可那光芒也会消失。在这样 一瞬间,人降生了,笑者,哭着,战斗,伤害,喜悦,悲伤憎恶,爱。一切都只是刹那间的邂逅,而最后都要归入死亡的永眠
Tom.Cat
禁止发言
禁止发言
  • 注册日期2001-10-10
  • 最后登录2019-07-29
  • 粉丝1
  • 关注0
  • 积分-53792分
  • 威望197411点
  • 贡献值0点
  • 好评度5点
  • 原创分0分
  • 专家分0分
  • 社区居民
8楼#
发布于:2004-08-13 11:42
用户被禁言,该主题自动屏蔽!
wowocock
VIP专家组
VIP专家组
  • 注册日期2002-04-08
  • 最后登录2016-01-09
  • 粉丝16
  • 关注2
  • 积分601分
  • 威望1651点
  • 贡献值1点
  • 好评度1227点
  • 原创分1分
  • 专家分0分
9楼#
发布于:2004-08-13 13:19
NTOSKRNL难道也不知道?????
花开了,然后又会凋零,星星是璀璨的,可那光芒也会消失。在这样 一瞬间,人降生了,笑者,哭着,战斗,伤害,喜悦,悲伤憎恶,爱。一切都只是刹那间的邂逅,而最后都要归入死亡的永眠
hexinzheng
驱动牛犊
驱动牛犊
  • 注册日期2005-05-26
  • 最后登录2009-02-22
  • 粉丝0
  • 关注0
  • 积分38分
  • 威望6点
  • 贡献值0点
  • 好评度2点
  • 原创分0分
  • 专家分0分
10楼#
发布于:2005-05-26 21:48
我想使用zwcreatesection来得到名称怎么办
游客

返回顶部