阅读:1407回复:2
98下用应用程序和驱动得到的PID为什么不一样?
98下取得pid
应用程序中是这样得到PID的 STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory( &si, sizeof(si) ); si.cb = sizeof(si); ZeroMemory( &pi, sizeof(pi) ); // Start the child process. if( !CreateProcess( NULL, // No module name (use command line). \"NOTEPAD.EXE E:\\\\Test\\\\111\\\\1112.txt\", // Command line. NULL, // Process handle not inheritable. NULL, // Thread handle not inheritable. FALSE, // Set handle inheritance to FALSE. 0, // No creation flags. NULL, // Use parent\'s environment block. NULL, // Use parent\'s starting directory. &si, // Pointer to STARTUPINFO structure. &pi ) // Pointer to PROCESS_INFORMATION structure. ) strPid.Format(\"%x\",pi.dwProcessId); GetDlgItem(IDC_EDIT_PID)->SetWindowText(strPid); 可是得到的PID和驱动(VXD)里的pir->pid值不一样,而且相差很大 这是为什么? 哪位大虾知道的话请帮个忙,谢了 |
|
沙发#
发布于:2003-02-12 09:30
呵呵!98下用应用程序得到的进程ID都是-1或者-2,而驱动程序得到的ID要和一个常数相异或之后才是进程的ID
|
|
板凳#
发布于:2003-02-14 11:15
虽然应用程序和驱动里得到的进程ID不同,但他们生成的ID都是唯一的。
如果在应用程序中生成的进程ID都是-1和-2,那Windows怎么区分两个进程的?要不就是用其他标记来区分的吗? |
|