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.

141 lines
4.2 KiB

  1. /******************************************************************************
  2. *
  3. * Copyright (c) 2000 Microsoft Corporation
  4. *
  5. * Module Name:
  6. * rpcapi.cpp
  7. *
  8. * Abstract:
  9. * callthroughs for server-side rpc api
  10. *
  11. * Revision History:
  12. * Brijesh Krishnaswami (brijeshk) 04/13/2000
  13. * created
  14. *
  15. *****************************************************************************/
  16. #include "precomp.h"
  17. #ifdef THIS_FILE
  18. #undef THIS_FILE
  19. #endif
  20. static char __szTraceSourceFile[] = __FILE__;
  21. #define THIS_FILE __szTraceSourceFile
  22. extern "C" DWORD DisableSRS(handle_t hif, LPCWSTR pszDrive)
  23. {
  24. return g_pEventHandler ? g_pEventHandler->DisableSRS((LPWSTR) pszDrive) : ERROR_SERVICE_DISABLED;
  25. }
  26. extern "C" DWORD EnableSRS(handle_t hif, LPCWSTR pszDrive)
  27. {
  28. return g_pEventHandler ? g_pEventHandler->EnableSRS((LPWSTR) pszDrive) : ERROR_SERVICE_DISABLED;
  29. }
  30. extern "C" DWORD ResetSRS(handle_t hif, LPCWSTR pszDrive)
  31. {
  32. return g_pEventHandler ? g_pEventHandler->OnReset((LPWSTR) pszDrive) : ERROR_SERVICE_DISABLED;
  33. }
  34. extern "C" DWORD DisableFIFOS(handle_t hif, DWORD dwRPNum)
  35. {
  36. return g_pEventHandler ? g_pEventHandler->DisableFIFOS(dwRPNum) : ERROR_SERVICE_DISABLED;
  37. }
  38. extern "C" BOOL SRSetRestorePointS(
  39. handle_t hif,
  40. PRESTOREPOINTINFOW pRPInfo,
  41. PSTATEMGRSTATUS pSMgrStatus)
  42. {
  43. return g_pEventHandler ? g_pEventHandler->SRSetRestorePointS(pRPInfo, pSMgrStatus) : FALSE;
  44. }
  45. extern "C" DWORD SRRemoveRestorePointS(
  46. handle_t hif,
  47. DWORD dwRPNum)
  48. {
  49. return g_pEventHandler ? g_pEventHandler->SRRemoveRestorePointS(dwRPNum) : ERROR_SERVICE_DISABLED;
  50. }
  51. extern "C" DWORD EnableFIFOS(handle_t hif)
  52. {
  53. return g_pEventHandler ? g_pEventHandler->EnableFIFOS() : ERROR_SERVICE_DISABLED;
  54. }
  55. extern "C" DWORD SRUpdateMonitoredListS(handle_t hif, LPCWSTR pszXMLFile)
  56. {
  57. return g_pEventHandler ? g_pEventHandler->SRUpdateMonitoredListS((LPWSTR) pszXMLFile) : ERROR_SERVICE_DISABLED;
  58. }
  59. extern "C" DWORD SRUpdateDSSizeS(handle_t hif, LPCWSTR pszDrive, UINT64 ullSizeLimit)
  60. {
  61. return g_pEventHandler ? g_pEventHandler->SRUpdateDSSizeS((LPWSTR) pszDrive, ullSizeLimit) : ERROR_SERVICE_DISABLED;
  62. }
  63. extern "C" DWORD SRSwitchLogS(handle_t hif)
  64. {
  65. return g_pEventHandler ? g_pEventHandler->SRSwitchLogS() : ERROR_SERVICE_DISABLED;
  66. }
  67. extern "C" DWORD FifoS(handle_t hif, LPCWSTR pszDrive, DWORD dwTargetRp, int nPercent, BOOL fIncludeCurrentRp, BOOL fFifoAtleastOneRp)
  68. {
  69. return g_pEventHandler ? g_pEventHandler->OnFifo((LPWSTR) pszDrive,
  70. dwTargetRp,
  71. nPercent,
  72. fIncludeCurrentRp,
  73. fFifoAtleastOneRp) : ERROR_SERVICE_DISABLED;
  74. }
  75. extern "C" DWORD CompressS(handle_t hif, LPCWSTR pszDrive)
  76. {
  77. return g_pEventHandler ? g_pEventHandler->OnCompress((LPWSTR) pszDrive) : ERROR_SERVICE_DISABLED;
  78. }
  79. extern "C" DWORD FreezeS(handle_t hif, LPCWSTR pszDrive)
  80. {
  81. return g_pEventHandler ? g_pEventHandler->OnFreeze((LPWSTR) pszDrive) : ERROR_SERVICE_DISABLED;
  82. }
  83. // fImproving - TRUE means going up
  84. // FALSE means going down
  85. extern "C" void SRNotifyS(handle_t hif, LPCWSTR pszDrive, DWORD dwFreeSpaceInMB, BOOL fImproving)
  86. {
  87. tenter("SRNotifyFreeSpaceS");
  88. trace(0, "**Shell : drive = %S, dwFreeSpaceInMB = %ld, fImproving = %d",
  89. pszDrive, dwFreeSpaceInMB, fImproving);
  90. WORKITEMFUNC pf = NULL;
  91. if (g_pEventHandler)
  92. {
  93. if (dwFreeSpaceInMB >= 200 && fImproving == TRUE)
  94. {
  95. pf = OnDiskFree_200;
  96. }
  97. else if (dwFreeSpaceInMB <= 49 && fImproving == FALSE)
  98. {
  99. pf = OnDiskFree_50;
  100. }
  101. else if (dwFreeSpaceInMB <= 79 && fImproving == FALSE)
  102. {
  103. pf = OnDiskFree_80;
  104. }
  105. if (pf != NULL)
  106. {
  107. g_pEventHandler->QueueWorkItem(pf, (PVOID) pszDrive);
  108. }
  109. }
  110. }
  111. extern "C" DWORD SRPrintStateS(handle_t hif)
  112. {
  113. return g_pEventHandler ? g_pEventHandler->SRPrintStateS() : ERROR_SERVICE_DISABLED;
  114. }