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.

92 lines
1.5 KiB

  1. #include "precomp.h"
  2. DWORD
  3. VerifyProtocols(
  4. PROTOCOL Protocol
  5. )
  6. {
  7. DWORD dwError = 0;
  8. switch (Protocol.ProtocolType) {
  9. case PROTOCOL_UNIQUE:
  10. if (Protocol.dwProtocol > 255) {
  11. dwError = ERROR_INVALID_PARAMETER;
  12. BAIL_ON_WIN32_ERROR(dwError);
  13. }
  14. break;
  15. default:
  16. dwError = ERROR_INVALID_PARAMETER;
  17. BAIL_ON_WIN32_ERROR(dwError);
  18. break;
  19. }
  20. error:
  21. return (dwError);
  22. }
  23. BOOL
  24. EqualProtocols(
  25. IN PROTOCOL OldProtocol,
  26. IN PROTOCOL NewProtocol
  27. )
  28. {
  29. BOOL bMatches = FALSE;
  30. if (OldProtocol.ProtocolType == NewProtocol.ProtocolType) {
  31. switch(OldProtocol.ProtocolType) {
  32. case PROTOCOL_UNIQUE:
  33. if (OldProtocol.dwProtocol == NewProtocol.dwProtocol) {
  34. bMatches = TRUE;
  35. }
  36. break;
  37. }
  38. }
  39. return (bMatches);
  40. }
  41. VOID
  42. CopyProtocols(
  43. IN PROTOCOL InProtocol,
  44. OUT PPROTOCOL pOutProtocol
  45. )
  46. {
  47. memcpy(
  48. pOutProtocol,
  49. &InProtocol,
  50. sizeof(PROTOCOL)
  51. );
  52. }
  53. BOOL
  54. MatchProtocols(
  55. PROTOCOL ProtocolToMatch,
  56. PROTOCOL ProtocolTemplate
  57. )
  58. {
  59. switch (ProtocolTemplate.ProtocolType) {
  60. case PROTOCOL_UNIQUE:
  61. if (ProtocolToMatch.dwProtocol) {
  62. if (ProtocolToMatch.dwProtocol !=
  63. ProtocolTemplate.dwProtocol) {
  64. return (FALSE);
  65. }
  66. }
  67. break;
  68. }
  69. return (TRUE);
  70. }