ptid (PTID) - output

      Address of a doubleword where the thread identifier of the created thread is returned.

    pfn (PFNTHREAD) - input

      Address of the code to be executed when the thread begins execution.

      This function is called near, accepts a single parameter param, and returns a doubleword exit status (see DosExit). Returning from the function without executing DosExit causes the thread to end. In this case, the exit status is the value in the EAX register when the thread ends.

    param (ULONG) - input

      An argument that is passed to the target thread routine as a parameter.

      It is usually a pointer to a parameter block.

    flag (ULONG) - input

      Thread flags.

      Possible values are a combination of the following:

      CREATE_READY (0x00000000)

        The new thread starts immediately.
      CREATE_SUSPENDED (0x00000001)
        The thread is created in the suspended state, and the creator of the thread must issue DosResumeThread to start the new thread's execution.
      STACK_SPARSE (0x00000000)
        The system uses the default method for initializing the thread's stack.
      STACK_COMMITED (0x00000002)
        The system precommits all the pages in the stack. One page is 4KB.

      cbStack (ULONG) - input

        The size, in bytes, of the new thread's stack.

        The size is rounded up to the nearest page boundary. If you specify a stack size of 0, you still get a one page (4K) stack.

        The system allocates the stack upon creation of the thread, and deallocates it upon completion of the thread. The system provides dynamic stack storage commitment up to the limit specified in cbStack by using the guard-page technique. See Remarks for more details.

      ulrc (APIRET) - returns

        Return Code.

        DosCreateThread returns one of the following values:

      • NO_ERROR 8
          ERROR_NOT_ENOUGH_MEMORY
        95
          ERROR_INTERRUPT
        115
          ERROR_PROTECTION_VIOLATION
        164
          ERROR_MAX_THRDS_REACHED
        For a full list of error codes, see Errors.


      [Back] [Next]