DWORD WSAAPI WsThreadInitialize(IN PWSTHREAD Thread, IN PWSPROCESS Process) { INT ErrorCode = WSASYSCALLFAILURE; /* Set the process */ Thread->Process = Process; /* Get the helper device */ if ((WsProcGetAsyncHelper(Process, &Thread->AsyncHelper)) == ERROR_SUCCESS) { /* Initialize a WAH Thread ID */ if ((WahOpenCurrentThread(Thread->AsyncHelper, &Thread->WahThreadId)) == ERROR_SUCCESS) { /* Success */ ErrorCode = ERROR_SUCCESS; } } /* Return */ return ErrorCode; }
INT DTHREAD::Initialize( IN PDPROCESS Process ) /*++ Routine Description: Completes the initialization of the DTHREAD object. This must be the first member function called for the DTHREAD object. This procedure should be called only once for the object. Note that this procedure should only be called internally within the DTHREAD class. Outside of the class, the "GetCurrentDThread" procedure should be used to retrieve a reference to a fully initialized DTHREAD object. Arguments: Process - Supplies a reference to the DPROCESS object associated with this DTHREAD object. Return Value: The function returns ERROR_SUCCESS if successful, otherwise it returns an appropriate WinSock error code. --*/ { INT ReturnCode= WSASYSCALLFAILURE; m_process = Process; // Store process pointer DEBUGF( DBG_TRACE, ("Initializing dthread %X\n", this)); // Init WAH thread: // Open the helper device if (Process->GetAsyncHelperDeviceID(&m_wah_helper_handle) == ERROR_SUCCESS) { //Initialize helper thread ID structure if (WahOpenCurrentThread(m_wah_helper_handle, & m_wah_thread_id) == ERROR_SUCCESS) { ReturnCode = ERROR_SUCCESS; } //if } //if return(ReturnCode); } //Initialize