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.

101 lines
1.8 KiB

  1. /*++=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. methods.cxx
  5. Abstract:
  6. Implements the W3Spoof object's IW3SpoofClientSupport interface.
  7. Author:
  8. Paul M Midgen (pmidge) 08-January-2001
  9. Revision History:
  10. 08-January-2001 pmidge
  11. Created
  12. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--*/
  13. #include "common.h"
  14. HRESULT
  15. __stdcall
  16. CW3Spoof::RegisterClient(BSTR Client, BSTR ScriptPath)
  17. {
  18. DEBUG_ENTER((
  19. DBG_W3SOBJ,
  20. rt_hresult,
  21. "CW3Spoof::RegisterClient",
  22. "this=%#x; Client=%S; ScriptPath=%.32S",
  23. this,
  24. Client,
  25. ScriptPath
  26. ));
  27. HRESULT hr = S_OK;
  28. DWORD ret = ERROR_SUCCESS;
  29. if( !Client || !ScriptPath )
  30. {
  31. hr = E_INVALIDARG;
  32. }
  33. else
  34. {
  35. ret = m_clientmap->Insert(
  36. Client,
  37. (void*) __widetobstr(ScriptPath)
  38. );
  39. //
  40. // if Insert() returns ERROR_DUP_NAME, don't increase the external
  41. // refcount.
  42. //
  43. if( ret == ERROR_SUCCESS )
  44. {
  45. AddConnection(EXTCONN_STRONG, 0L);
  46. }
  47. else if( ret == ERROR_OUTOFMEMORY )
  48. {
  49. hr = E_OUTOFMEMORY;
  50. }
  51. }
  52. DEBUG_LEAVE(hr);
  53. return hr;
  54. }
  55. HRESULT
  56. __stdcall
  57. CW3Spoof::RevokeClient(BSTR Client)
  58. {
  59. DEBUG_ENTER((
  60. DBG_W3SOBJ,
  61. rt_hresult,
  62. "CW3Spoof::RevokeClient",
  63. "this=%#x; Client=%S",
  64. this,
  65. Client
  66. ));
  67. HRESULT hr = S_OK;
  68. if( ERROR_SUCCESS != m_clientmap->Delete(Client, NULL) )
  69. {
  70. hr = E_FAIL;
  71. }
  72. else
  73. {
  74. ReleaseConnection(EXTCONN_STRONG, 0L, TRUE);
  75. }
  76. DEBUG_LEAVE(hr);
  77. return hr;
  78. }