Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
1.8 KiB

  1. /*************************************************************************
  2. * TASK1.C
  3. *
  4. * Routines used to enumerate all tasks.
  5. *
  6. *************************************************************************/
  7. #include <string.h>
  8. #include "toolpriv.h"
  9. /* ----- Functions ----- */
  10. /* TaskFirst
  11. * Returns information about the first task in the task chain.
  12. */
  13. BOOL TOOLHELPAPI TaskFirst(
  14. TASKENTRY FAR *lpTask)
  15. {
  16. /* Check for errors */
  17. if (!wLibInstalled || !lpTask || lpTask->dwSize != sizeof (TASKENTRY))
  18. return FALSE;
  19. /* Pass a pointer to the first block to the assembly routine */
  20. return TaskInfo(lpTask, *(WORD FAR *)MAKEFARPTR(segKernel, npwTDBHead));
  21. }
  22. /* TaskNext
  23. * Returns information about the next task in the task chain.
  24. */
  25. BOOL TOOLHELPAPI TaskNext(
  26. TASKENTRY FAR *lpTask)
  27. {
  28. /* Check for errors */
  29. if (!wLibInstalled || !lpTask || !lpTask->hNext ||
  30. lpTask->dwSize != sizeof (TASKENTRY))
  31. return FALSE;
  32. /* Pass a pointer to the next block to the assembly routine */
  33. return TaskInfo(lpTask, lpTask->hNext);
  34. }
  35. /* TaskFindHandle
  36. * Returns information about the task with the given task handle.
  37. */
  38. BOOL TOOLHELPAPI TaskFindHandle(
  39. TASKENTRY FAR *lpTask,
  40. HANDLE hTask)
  41. {
  42. /* Check for errors */
  43. if (!wLibInstalled || !lpTask || lpTask->dwSize != sizeof (TASKENTRY))
  44. return FALSE;
  45. #ifdef WOW
  46. if ( (hTask & 0x4) == 0 && hTask <= 0xffe0 && hTask != 0 ) {
  47. //
  48. // If they are getting a task handle for an htask alias, then
  49. // just fill in the hinst method and return.
  50. //
  51. // Special hack for OLE 2.0's BusyDialog.
  52. //
  53. lpTask->hInst = hTask;
  54. return( TRUE );
  55. }
  56. #endif
  57. /* Pass a pointer to the first block to the assembly routine */
  58. return TaskInfo(lpTask, hTask);
  59. }