Source code of Windows XP (NT5)
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. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: C A C H E . C P P
  7. //
  8. // Contents: Public APIs dealing with SSDP cache
  9. //
  10. // Notes:
  11. //
  12. // Author: tongl 18 Jan 2000
  13. //
  14. //----------------------------------------------------------------------------
  15. #include <pch.h>
  16. #pragma hdrstop
  17. #include "ssdpapi.h"
  18. #include "common.h"
  19. #include "ncdefine.h"
  20. #include "ncdebug.h"
  21. #include <rpcasync.h> // I_RpcExceptionFilter
  22. extern LONG cInitialized;
  23. //+---------------------------------------------------------------------------
  24. //
  25. // Function: CleanupCache
  26. //
  27. // Purpose: Public API to clean up SSDP cache
  28. //
  29. BOOL WINAPI CleanupCache()
  30. {
  31. ULONG ulStatus = NOERROR;
  32. BOOL fResult = FALSE;
  33. if (InterlockedExchange(&cInitialized, cInitialized) == 0)
  34. {
  35. SetLastError(ERROR_NOT_READY);
  36. return FALSE;
  37. }
  38. RpcTryExcept
  39. {
  40. CleanupCacheRpc();
  41. fResult = TRUE;
  42. }
  43. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode()))
  44. {
  45. ulStatus = RpcExceptionCode();
  46. }
  47. RpcEndExcept
  48. {
  49. SetLastError(ulStatus);
  50. }
  51. TraceResult("CleanupCache", fResult);
  52. return fResult;
  53. }