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.

108 lines
1.9 KiB

  1. /*++
  2. Copyright (C) 2000 Microsoft Corporation
  3. Module Name:
  4. crypstub.cpp
  5. Abstract:
  6. RPC Proxy Stub to handle downlevel requests to the services.exe
  7. pipe
  8. Author:
  9. petesk 3/1/00
  10. Revisions:
  11. --*/
  12. #include <nt.h>
  13. #include <ntrtl.h>
  14. #include <nturtl.h>
  15. #include <windows.h>
  16. #include <svcs.h> // SVCS_
  17. #include "crypstub.h"
  18. #include "keyrpc.h"
  19. #include "keysvc.h"
  20. //
  21. // global module handle used to reference resources contained in this module.
  22. //
  23. HINSTANCE g_hInst = NULL;
  24. BOOL
  25. WINAPI
  26. DllMain(
  27. HMODULE hInst,
  28. DWORD dwReason,
  29. LPVOID lpReserved
  30. )
  31. {
  32. if( dwReason == DLL_PROCESS_ATTACH ) {
  33. g_hInst = hInst;
  34. DisableThreadLibraryCalls(hInst);
  35. }
  36. return TRUE;
  37. }
  38. NTSTATUS
  39. WINAPI
  40. StartCryptServiceStubs(
  41. PSVCS_START_RPC_SERVER RpcpStartRpcServer,
  42. LPTSTR SvcsRpcPipeName
  43. )
  44. {
  45. NTSTATUS dwStatus = STATUS_SUCCESS;
  46. //
  47. // enable negotiate protocol, as, clients expect this to work against the
  48. // stub.
  49. //
  50. RpcServerRegisterAuthInfoW( NULL, RPC_C_AUTHN_GSS_NEGOTIATE, NULL, NULL );
  51. dwStatus = RpcpStartRpcServer(
  52. SvcsRpcPipeName,
  53. s_BackupKey_v1_0_s_ifspec
  54. );
  55. if(NT_SUCCESS(dwStatus))
  56. {
  57. dwStatus = RpcpStartRpcServer(
  58. SvcsRpcPipeName,
  59. s_IKeySvc_v1_0_s_ifspec
  60. );
  61. }
  62. return dwStatus;
  63. }
  64. NTSTATUS
  65. WINAPI
  66. StopCryptServiceStubs(
  67. PSVCS_STOP_RPC_SERVER RpcpStopRpcServer
  68. )
  69. {
  70. NTSTATUS dwStatus = STATUS_SUCCESS;
  71. RpcpStopRpcServer(
  72. s_BackupKey_v1_0_s_ifspec
  73. );
  74. dwStatus = RpcpStopRpcServer(
  75. s_IKeySvc_v1_0_s_ifspec
  76. );
  77. return dwStatus;
  78. }