void CSerialPort::Set0WriteTimeout() { COMMTIMEOUTS Timeouts; GetTimeouts(Timeouts); Timeouts.WriteTotalTimeoutMultiplier = 0; Timeouts.WriteTotalTimeoutConstant = 0; SetTimeouts(Timeouts); }
void CSerialPort::Set0ReadTimeout() { COMMTIMEOUTS Timeouts; GetTimeouts(Timeouts); Timeouts.ReadIntervalTimeout = MAXDWORD; Timeouts.ReadTotalTimeoutMultiplier = 0; Timeouts.ReadTotalTimeoutConstant = 0; SetTimeouts(Timeouts); }
NTSTATUS UserServerDllInitialization( PCSR_SERVER_DLL psrvdll) { CLIENT_ID ClientId; DWORD cbAllocated; NTSTATUS Status; int i; /* * Initialize a critical section structure that will be used to protect * all of the User Server's critical sections (except a few special * cases like the RIT -- see below). */ RtlInitializeCriticalSection(&gcsUserSrv); EnterCrit(); // synchronize heap calls /* * Remember WINSRV.DLL's hmodule so we can grab resources from it later. */ hModuleWin = psrvdll->ModuleHandle; psrvdll->ApiNumberBase = USERK_FIRST_API_NUMBER; psrvdll->MaxApiNumber = UserpMaxApiNumber; psrvdll->ApiDispatchTable = UserServerApiDispatchTable; psrvdll->ApiServerValidTable = UserServerApiServerValidTable; #if DBG psrvdll->ApiNameTable = UserServerApiNameTable; #else psrvdll->ApiNameTable = NULL; #endif psrvdll->PerProcessDataLength = CHANDLES * sizeof(HANDLE); psrvdll->PerThreadDataLength = 0; psrvdll->ConnectRoutine = UserClientConnect; psrvdll->DisconnectRoutine = UserClientDisconnect; psrvdll->HardErrorRoutine = UserHardError; psrvdll->ShutdownProcessRoutine = UserClientShutdown; /* * Create these events used by shutdown */ NtCreateEvent(&heventCancel, EVENT_ALL_ACCESS, NULL, NotificationEvent, FALSE); NtCreateEvent(&heventCancelled, EVENT_ALL_ACCESS, NULL, NotificationEvent, FALSE); /* * Tell the base what user address to call when it is creating a process * (but before the process starts running). */ BaseSetProcessCreateNotify(NtUserNotifyProcessCreate); /* * Set up translation tables. */ InitOemXlateTables(); /* * Get timeout values from registry */ GetTimeouts(); /* * Load some strings. */ pszaSUCCESS = (LPSTR)RtlLoadStringOrError(hModuleWin, STR_SUCCESS, NULL, &cbAllocated, TRUE); pszaSYSTEM_INFORMATION = (LPSTR)RtlLoadStringOrError(hModuleWin, STR_SYSTEM_INFORMATION, NULL, &cbAllocated, TRUE); pszaSYSTEM_WARNING = (LPSTR)RtlLoadStringOrError(hModuleWin, STR_SYSTEM_WARNING, NULL, &cbAllocated, TRUE); pszaSYSTEM_ERROR = (LPSTR)RtlLoadStringOrError(hModuleWin, STR_SYSTEM_ERROR, NULL, &cbAllocated, TRUE); /* * Add marlett font and make it permanent */ i = GdiAddFontResourceW(L"marlett.ttf", AFRW_ADD_LOCAL_FONT); /* * Initialize USER */ { HANDLE hModBase; LeaveCrit(); hModBase = GetModuleHandle(TEXT("kernel32")); EnterCrit(); UserAssert(hModBase); gpfnAttachRoutine = GetProcAddress(hModBase,"BaseAttachCompleteThunk"); UserAssert(gpfnAttachRoutine); Status = NtUserInitialize(USERCURRENTVERSION, gpfnAttachRoutine); if (!NT_SUCCESS(Status)) { goto ExitUserInit; } } /* * Start registry notification thread */ Status = RtlCreateUserThread(NtCurrentProcess(), NULL, FALSE, 0, 0, 4*0x1000, (PUSER_THREAD_START_ROUTINE)NotificationThread, NULL, &hThreadNotification, &ClientId); CsrAddStaticServerThread(hThreadNotification, &ClientId, 0); ExitUserInit: LeaveCrit(); return Status; }