MSDN中关于JOBOBJECT_BASIC_PROCESS_ID_LIST解释有误?解决思路
MSDN中关于JOBOBJECT_BASIC_PROCESS_ID_LIST解释有误?!
typedef struct _JOBOBJECT_BASIC_PROCESS_ID_LIST {
DWORD NumberOfAssignedProcesses;
DWORD NumberOfProcessIdsInList;
ULONG_PTR ProcessIdList[1];
} JOBOBJECT_BASIC_PROCESS_ID_LIST, *PJOBOBJECT_BASIC_PROCESS_ID_LIST;
《windows核心编程》上说:
//Tell the function the maximum number of processes
//that we allocated space for.
pjobpil-> NumberOfAssignedProcesses = MAX_PROCESS_IDS;
总结出:
NumberOfAssignedProcesses是用户指定的数目
NumberOfProcessIdsInList是返回的实际数目
MSDN上说:
NumberOfProcessIdsInList
Number of process identifiers returned in the ProcessIdList buffer. If this number is less than NumberOfAssignedProcesses, increase the size of the buffer to accommodate the complete list.
意思是:如果这个数目小于事先指定的数目,增加(原先指定的接收)缓冲区的尺寸以接纳完整的(进程ID)列表
我的观点:MSDN说反了吧,应该是大于事先指定的数目才用得着增加缓冲区尺寸吧。
------解决方案--------------------
撇开楼主问题来说,我碰到过好几次MSDN的错误。
typedef struct _JOBOBJECT_BASIC_PROCESS_ID_LIST {
DWORD NumberOfAssignedProcesses;
DWORD NumberOfProcessIdsInList;
ULONG_PTR ProcessIdList[1];
} JOBOBJECT_BASIC_PROCESS_ID_LIST, *PJOBOBJECT_BASIC_PROCESS_ID_LIST;
《windows核心编程》上说:
//Tell the function the maximum number of processes
//that we allocated space for.
pjobpil-> NumberOfAssignedProcesses = MAX_PROCESS_IDS;
总结出:
NumberOfAssignedProcesses是用户指定的数目
NumberOfProcessIdsInList是返回的实际数目
MSDN上说:
NumberOfProcessIdsInList
Number of process identifiers returned in the ProcessIdList buffer. If this number is less than NumberOfAssignedProcesses, increase the size of the buffer to accommodate the complete list.
意思是:如果这个数目小于事先指定的数目,增加(原先指定的接收)缓冲区的尺寸以接纳完整的(进程ID)列表
我的观点:MSDN说反了吧,应该是大于事先指定的数目才用得着增加缓冲区尺寸吧。
------解决方案--------------------
撇开楼主问题来说,我碰到过好几次MSDN的错误。