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.

109 lines
3.2 KiB

  1. /************************************************************************
  2. * *
  3. * INTEL CORPORATION PROPRIETARY INFORMATION *
  4. * *
  5. * This software is supplied under the terms of a license *
  6. * agreement or non-disclosure agreement with Intel Corporation *
  7. * and may not be copied or disclosed except in accordance *
  8. * with the terms of that agreement. *
  9. * *
  10. * Copyright (C) 1997 Intel Corp. All Rights Reserved *
  11. * *
  12. * $Archive: S:\sturgeon\src\gki\vcs\gkideng.cpv $
  13. * *
  14. * $Revision: 1.6 $
  15. * $Date: 12 Feb 1997 01:12:12 $
  16. * *
  17. * $Author: CHULME $
  18. * *
  19. * $Log: S:\sturgeon\src\gki\vcs\gkideng.cpv $
  20. //
  21. // Rev 1.6 12 Feb 1997 01:12:12 CHULME
  22. // Redid thread synchronization to use Gatekeeper.Lock
  23. //
  24. // Rev 1.5 17 Jan 1997 09:02:12 CHULME
  25. // Changed reg.h to gkreg.h to avoid name conflict with inc directory
  26. //
  27. // Rev 1.4 10 Jan 1997 16:15:32 CHULME
  28. // Removed MFC dependency
  29. //
  30. // Rev 1.3 20 Dec 1996 16:38:36 CHULME
  31. // Fixed access synchronization with Gatekeeper lock
  32. //
  33. // Rev 1.2 02 Dec 1996 23:49:54 CHULME
  34. // Added premptive synchronization code
  35. //
  36. // Rev 1.1 22 Nov 1996 15:20:08 CHULME
  37. // Added VCS log to the header
  38. *************************************************************************/
  39. // gkidisengage.cpp : Handles the GKI_DisengageRequest API
  40. //
  41. #include "precomp.h"
  42. #include <process.h>
  43. #include <winsock.h>
  44. #include "GKICOM.H"
  45. #include "dspider.h"
  46. #include "dgkilit.h"
  47. #include "DGKIPROT.H"
  48. #include "GATEKPR.H"
  49. #include "gksocket.h"
  50. #include "GKREG.H"
  51. #include "dcall.h"
  52. #include "h225asn.h"
  53. #include "coder.hpp"
  54. #include "dgkiext.h"
  55. #ifdef _DEBUG
  56. #undef THIS_FILE
  57. static char THIS_FILE[] = __FILE__;
  58. #endif
  59. extern "C" HRESULT DLL_EXPORT
  60. GKI_DisengageRequest(HANDLE hCall)
  61. {
  62. // ABSTRACT: This function is exported. It is called by the client application
  63. // to unregister with the Gatekeeper. The handle supplied by the client
  64. // is actually a pointer to the CRegistration object, which will be
  65. // deleted
  66. // AUTHOR: Colin Hulme
  67. HRESULT hResult;
  68. CCall *pCall;
  69. #ifdef _DEBUG
  70. char szGKDebug[80];
  71. #endif
  72. SPIDER_TRACE(SP_FUNC, "GKI_DisengageRequest(%X)\n", hCall);
  73. SPIDER_TRACE(SP_GKI, "GKI_DisengageRequest(%X)\n", hCall);
  74. // Create a Gatekeeper lock object on the stack
  75. // It's constructor will lock pGK and when we return
  76. // from any path, its destructor will unlock pGK
  77. CGatekeeperLock GKLock(g_pGatekeeper);
  78. if (g_pReg == 0)
  79. return (GKI_NOT_REG);
  80. if (g_pReg->GetState() != CRegistration::GK_REGISTERED)
  81. return (GKI_NOT_REG);
  82. // Validate call pointer
  83. pCall = (CCall *)hCall;
  84. if (IsBadReadPtr(pCall, sizeof(CCall)))
  85. return (GKI_HANDLE_ERROR);
  86. if (pCall != (CCall *)pCall->GetHCall())
  87. return (GKI_HANDLE_ERROR);
  88. // Protect against concurrent PDUs
  89. if (pCall->GetRasMessage() != 0)
  90. return (GKI_BUSY);
  91. // Create DisengageRequest structure - Encode and send PDU
  92. if ((hResult = pCall->DisengageRequest()) != GKI_OK)
  93. return (hResult);
  94. return (GKI_OK);
  95. }