网站首页  词典首页

请输入您要查询的函数:

 

术语 createjobobject
释义 CreateJobObject
语法:
C++
HANDLE WINAPI CreateJobObject(
__in_opt LPSECURITY_ATTRIBUTES lpJobAttributes,
__in_opt LPCTSTR lpName
);
CreateJobObject功能
创建或打开一个工作对象。
参数
lpJobAttributes [中,可选]
一个 SECURITY_ATTRIBUTES结构,指定的作业对象的安全描述符,并决定是否可以继承子进程返回的句柄的指针。 If lpJobAttributes is NULL, the job object gets a default security descriptor and the handle cannot be inherited.在求职默认安全描述符的ACL对象来自小学或模拟令牌的创造者。
lpName [中,可选]
该工作的名称。该名称被限制为MAX_PATH字符。名称比较是区分大小写的。
如果lpName为NULL,则创建工作没有名称。
如果lpName匹配现有的事件,信号量,互斥体,可等待计时器或文件映射对象,该函数失败,而且GetLastError函数返回出现ERROR_INVALID_HANDLE名。这是因为这些对象共享相同的名称空间。
该对象可以创建一个私人空间。有关更多信息,请参见对象命名。
终端服务:名称可以有一个“全球\\”或“Local \\”前缀明确创建对象的全球或会话名称空间。名称的其余部分可以包含以外的任何字符反斜杠字符(\\)。如需信息见命名内核对象。
窗口2000:如果终端服务没有运行,“全球\\”和“地方\\”前缀将被忽略。名称的其余部分可以包含反斜杠以外的任何字符的字符。
返回值
如果函数成功,返回值是一个句柄作业对象。句柄有JOB_OBJECT_ALL_ACCESS访问的权利。如果该对象在函数调用之前存在,函数返回的句柄现有的作业对象和GetLastError返回ERROR_ALREADY_EXISTS。
如果函数失败,返回值为NULL。为了获得更多错误信息,调用GetLastError。
备注
当创建一个作业,其会计信息被初始化为零,所有的限制并不活跃,有没有关联的过程。要指定一个过程,工作对象,请使用AssignProcessToJobObject功能。要为就业限制,使用SetInformationJobObject功能。会计信息查询,使用QueryInformationJobObject功能。
所有进程与工作必须运行在同一个会话。一个工作是与第一个进程外会话被分配到工作。
Windows Server 2003和Windows XP/2000操作系统:是与创建它的进程会议有关的工作。
要关闭工作对象的处理,使用CloseHandle函数。这项工作被销毁最近一次的处理已经关闭,所有相关的进程都退出。但是,如果工作有JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE标志指定,关闭最后一个作业对象处理终止所有相关的进程,然后销毁工作对象本身。
要编译的应用程序使用此功能,定义_WIN32_WINNT为0x0500或更高版本。有关详细信息,请参阅使用Windows头。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode和ANSI namesCreateJobObjectW(Unicode)和CreateJobObjectA(ANSI)的
参见
AssignProcessToJobObject
CloseHandle
招聘对象
进程和线程函数
QueryInformationJobObject
SECURITY_ATTRIBUTES
SetInformationJobObject
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==CreateJobObject Function
Creates or opens a job object.
Syntax
C++
HANDLE WINAPI CreateJobObject(
__in_opt LPSECURITY_ATTRIBUTES lpJobAttributes,
__in_opt LPCTSTR lpName
);
Parameters
lpJobAttributes [in, optional]
A pointer to a SECURITY_ATTRIBUTES structure that specifies the security descriptor for the job object and determines whether child processes can inherit the returned handle. If lpJobAttributes is NULL, the job object gets a default security descriptor and the handle cannot be inherited. The ACLs in the default security descriptor for a job object come from the primary or impersonation token of the creator.
lpName [in, optional]
The name of the job. The name is limited to MAX_PATH characters. Name comparison is case-sensitive.
If lpName is NULL, the job is created without a name.
If lpName matches the name of an existing event, semaphore, mutex, waitable timer, or file-mapping object, the function fails and the GetLastError function returns ERROR_INVALID_HANDLE. This occurs because these objects share the same name space.
The object can be created in a private namespace. For more information, see Object Namespaces .
Terminal Services: The name can have a "Global\\" or "Local\\" prefix to explicitly create the object in the global or session name space. The remainder of the name can contain any character except the backslash character (\\). For more information, see Kernel Object Namespaces .
Windows 2000: If Terminal Services is not running, the "Global\\" and "Local\\" prefixes are ignored. The remainder of the name can contain any character except the backslash character.
Return Value
If the function succeeds, the return value is a handle to the job object. The handle has the JOB_OBJECT_ALL_ACCESS access right. If the object existed before the function call, the function returns a handle to the existing job object and GetLastError returns ERROR_ALREADY_EXISTS.
If the function fails, the return value is NULL. To get extended error information, call GetLastError.
Remarks
When a job is created, its accounting information is initialized to zero, all limits are inactive, and there are no associated processes. To assign a process to a job object, use the AssignProcessToJobObject function. To set limits for a job, use the SetInformationJobObject function. To query accounting information, use the QueryInformationJobObject function.
All processes associated with a job must run in the same session. A job is associated with the session of the first process to be assigned to the job.
Windows Server 2003 and Windows XP/2000: A job is associated with the session of the process that created it.
To close a job object handle, use the CloseHandle function. The job is destroyed when its last handle has been closed and all associated processes have exited. However, if the job has the JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE flag specified, closing the last job object handle terminates all associated processes and then destroys the job object itself.
To compile an application that uses this function, define _WIN32_WINNT as 0x0500 or later. For more information, see Using the Windows Headers .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode and ANSI namesCreateJobObjectW (Unicode) and CreateJobObjectA (ANSI)
See Also
AssignProcessToJobObject
CloseHandle
Job Objects
Process and Thread Functions
QueryInformationJobObject
SECURITY_ATTRIBUTES
SetInformationJobObject
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms682409(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 更新时间:2025/1/8 10:57:35