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.

204 lines
4.2 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. stub.c
  5. Abstract:
  6. Stubbed out Windows File Protection APIs. These APIs are "Millenium" SFC
  7. apis, which we simply stub out so that any clients programming to these
  8. APIs may work on both platforms
  9. Author:
  10. Andrew Ritz (andrewr) 23-Sep-1999
  11. Revision History:
  12. --*/
  13. #include <windows.h>
  14. #include <srrestoreptapi.h>
  15. DWORD
  16. WINAPI
  17. SfpInstallCatalog(
  18. IN LPCSTR pszCatName,
  19. IN LPCSTR pszCatDependency,
  20. IN PVOID Reserved
  21. )
  22. {
  23. return ERROR_CALL_NOT_IMPLEMENTED;
  24. }
  25. DWORD
  26. WINAPI
  27. SfpDeleteCatalog(
  28. IN LPCSTR pszCatName,
  29. IN PVOID Reserved
  30. )
  31. {
  32. return ERROR_CALL_NOT_IMPLEMENTED;
  33. }
  34. BOOL
  35. WINAPI
  36. SfpVerifyFile(
  37. IN LPCSTR pszFileName,
  38. IN LPSTR pszError,
  39. IN DWORD dwErrSize
  40. )
  41. {
  42. SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
  43. return(FALSE);
  44. }
  45. #undef SRSetRestorePoint
  46. #undef SRSetRestorePointA
  47. #undef SRSetRestorePointW
  48. typedef BOOL (WINAPI * PSETRESTOREPOINTA) (PRESTOREPOINTINFOA, PSTATEMGRSTATUS);
  49. typedef BOOL (WINAPI * PSETRESTOREPOINTW) (PRESTOREPOINTINFOW, PSTATEMGRSTATUS);
  50. BOOL
  51. WINAPI
  52. SRSetRestorePointA ( PRESTOREPOINTINFOA pRestorePtSpec,
  53. PSTATEMGRSTATUS pSMgrStatus )
  54. {
  55. HMODULE hClient = LoadLibrary (L"SRCLIENT.DLL");
  56. BOOL fReturn = FALSE;
  57. if (hClient != NULL)
  58. {
  59. PSETRESTOREPOINTA pSetRestorePointA = (PSETRESTOREPOINTA )
  60. GetProcAddress (hClient, "SRSetRestorePointA");
  61. if (pSetRestorePointA != NULL)
  62. {
  63. fReturn = (* pSetRestorePointA) (pRestorePtSpec, pSMgrStatus);
  64. }
  65. else if (pSMgrStatus != NULL)
  66. pSMgrStatus->nStatus = ERROR_CALL_NOT_IMPLEMENTED;
  67. FreeLibrary (hClient);
  68. }
  69. else if (pSMgrStatus != NULL)
  70. pSMgrStatus->nStatus = ERROR_CALL_NOT_IMPLEMENTED;
  71. return fReturn;
  72. }
  73. BOOL
  74. WINAPI
  75. SRSetRestorePointW ( PRESTOREPOINTINFOW pRestorePtSpec,
  76. PSTATEMGRSTATUS pSMgrStatus )
  77. {
  78. HMODULE hClient = LoadLibrary (L"SRCLIENT.DLL");
  79. BOOL fReturn = FALSE;
  80. if (hClient != NULL)
  81. {
  82. PSETRESTOREPOINTW pSetRestorePointW = (PSETRESTOREPOINTW )
  83. GetProcAddress (hClient, "SRSetRestorePointW");
  84. if (pSetRestorePointW != NULL)
  85. {
  86. fReturn = (* pSetRestorePointW) (pRestorePtSpec, pSMgrStatus);
  87. }
  88. else if (pSMgrStatus != NULL)
  89. pSMgrStatus->nStatus = ERROR_CALL_NOT_IMPLEMENTED;
  90. FreeLibrary (hClient);
  91. }
  92. else if (pSMgrStatus != NULL)
  93. pSMgrStatus->nStatus = ERROR_CALL_NOT_IMPLEMENTED;
  94. return fReturn;
  95. }
  96. #include <sfcapip.h>
  97. ULONG
  98. MySfcInitProt(
  99. IN ULONG OverrideRegistry,
  100. IN ULONG RegDisable, OPTIONAL
  101. IN ULONG RegScan, OPTIONAL
  102. IN ULONG RegQuota, OPTIONAL
  103. IN HWND ProgressWindow, OPTIONAL
  104. IN PCWSTR SourcePath, OPTIONAL
  105. IN PCWSTR IgnoreFiles OPTIONAL
  106. )
  107. {
  108. return SfcInitProt( OverrideRegistry, RegDisable, RegScan, RegQuota, ProgressWindow, SourcePath, IgnoreFiles);
  109. }
  110. VOID
  111. MySfcTerminateWatcherThread(
  112. VOID
  113. )
  114. {
  115. SfcTerminateWatcherThread();
  116. }
  117. HANDLE
  118. WINAPI
  119. MySfcConnectToServer(
  120. IN PCWSTR ServerName
  121. )
  122. {
  123. return SfcConnectToServer(ServerName);
  124. }
  125. VOID
  126. MySfcClose(
  127. IN HANDLE RpcHandle
  128. )
  129. {
  130. SfcClose(RpcHandle);
  131. }
  132. DWORD
  133. WINAPI
  134. MySfcFileException(
  135. IN HANDLE RpcHandle,
  136. IN PCWSTR FileName,
  137. IN DWORD ExpectedChangeType
  138. )
  139. {
  140. return SfcFileException(RpcHandle, FileName, ExpectedChangeType);
  141. }
  142. DWORD
  143. WINAPI
  144. MySfcInitiateScan(
  145. IN HANDLE RpcHandle,
  146. IN DWORD ScanWhen
  147. )
  148. {
  149. return SfcInitiateScan(RpcHandle, ScanWhen);
  150. }
  151. BOOL
  152. WINAPI
  153. MySfcInstallProtectedFiles(
  154. IN HANDLE RpcHandle,
  155. IN PCWSTR FileNames,
  156. IN BOOL AllowUI,
  157. IN PCWSTR ClassName,
  158. IN PCWSTR WindowName,
  159. IN PSFCNOTIFICATIONCALLBACK SfcNotificationCallback,
  160. IN DWORD_PTR Context OPTIONAL
  161. )
  162. {
  163. return SfcInstallProtectedFiles(RpcHandle, FileNames, AllowUI, ClassName, WindowName, SfcNotificationCallback, Context);
  164. }