Leaked source code of windows server 2003
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.

60 lines
1.3 KiB

  1. /*++
  2. *
  3. * WOW v1.0
  4. *
  5. * Copyright (c) 1991, Microsoft Corporation
  6. *
  7. * WOWCOMM.C
  8. * WOW16 user resource services
  9. *
  10. * History:
  11. *
  12. * Created 28-Apr-1993 by Craig Jones (v-cjones)
  13. *
  14. * This file provides support for the Win 3.1 SetCommEventMask() API.
  15. * SetCommEventMask() returns a 16:16 ptr to the app so it can monitor
  16. * the event word & shadow MSR.
  17. *
  18. --*/
  19. #include <windows.h>
  20. #include <wowcomm.h>
  21. int WINAPI WOWCloseComm(int idComDev, LPDWORD lpdwEvts);
  22. int WINAPI WOWOpenComm(LPCSTR lpszPort, UINT cbInQ, UINT cbOutQ, DWORD dwEvts);
  23. int WINAPI ICloseComm(int idComDev)
  24. {
  25. int ret;
  26. DWORD dwEvts = 0;
  27. // we're really calling wu32CloseComm() here
  28. ret = WOWCloseComm(idComDev, (LPDWORD)&dwEvts);
  29. // free this 16:16 memory if it was alloc'd in IOpenComm()
  30. if(dwEvts) {
  31. GlobalDosFree((UINT)LOWORD(dwEvts));
  32. }
  33. return(ret);
  34. }
  35. int WINAPI IOpenComm(LPCSTR lpszPort, UINT cbInQ, UINT cbOutQ)
  36. {
  37. int ret;
  38. DWORD dwEvts;
  39. dwEvts = GlobalDosAlloc((DWORD)sizeof(COMDEB16));
  40. // we're really calling wu32OpenComm() here
  41. ret = WOWOpenComm(lpszPort, cbInQ, cbOutQ, dwEvts);
  42. // if OpenComm() failed - free the 16:16 memory
  43. if((ret < 0) && (dwEvts)) {
  44. GlobalDosFree((UINT)LOWORD(dwEvts));
  45. }
  46. return(ret);
  47. }