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.

100 lines
4.3 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Copyright (c) 1997-1999 Microsoft Corporation
  4. //
  5. // File: errcode.cpp
  6. //
  7. // Contents: Convert License Server error code to TLSAPI return code
  8. //
  9. // History:
  10. //
  11. //---------------------------------------------------------------------------
  12. #include "pch.cpp"
  13. #include "server.h"
  14. #include "messages.h"
  15. //+------------------------------------------------------------------------
  16. // Function:
  17. // LSMapReturnCode()
  18. //
  19. // Description:
  20. // Map license server internal code to RPC return code
  21. //
  22. // Arguments:
  23. // dwCode - license server internal code
  24. //
  25. // Return Value:
  26. // RPC return code.
  27. //
  28. // Note:
  29. // Internal routine within this file.
  30. //-------------------------------------------------------------------------
  31. DWORD
  32. TLSMapReturnCode(DWORD dwCode)
  33. {
  34. static struct _TLSMapReturnCode {
  35. DWORD dwErrCode;
  36. DWORD dwReturnCode;
  37. } MapReturnCode[] = {
  38. {ERROR_SUCCESS, LSERVER_S_SUCCESS},
  39. {TLS_I_SERVICE_STOP, LSERVER_I_SERVICE_SHUTDOWN},
  40. {TLS_I_NO_MORE_DATA, LSERVER_I_NO_MORE_DATA},
  41. {TLS_W_LICENSE_PROXIMATE, LSERVER_I_PROXIMATE_LICENSE},
  42. {TLS_W_TEMPORARY_LICENSE_ISSUED, LSERVER_I_TEMPORARY_LICENSE},
  43. {TLS_I_FOUND_TEMPORARY_LICENSE, LSERVER_I_TEMPORARY_LICENSE},
  44. {TLS_E_INTERNAL, LSERVER_E_INTERNAL_ERROR},
  45. {TLS_E_ACCESS_DENIED, LSERVER_E_ACCESS_DENIED},
  46. {TLS_E_DUPLICATE_RECORD, LSERVER_E_DUPLICATE},
  47. {TLS_E_SPKALREADYEXIST, LSERVER_E_DUPLICATE},
  48. {ERROR_INVALID_HANDLE, LSERVER_E_INVALID_HANDLE},
  49. {TLS_E_INVALID_SEQUENCE, LSERVER_E_INVALID_SEQUENCE},
  50. {TLS_E_ALLOCATE_HANDLE, LSERVER_E_SERVER_BUSY},
  51. {ERROR_OUTOFMEMORY, LSERVER_E_OUTOFMEMORY},
  52. {TLS_E_INVALID_DATA, LSERVER_E_INVALID_DATA},
  53. {ERROR_INVALID_DATA, LSERVER_E_INVALID_DATA},
  54. {TLS_E_DECODE_LKP, LSERVER_E_INVALID_DATA},
  55. {TLS_E_RECORD_NOTFOUND, LSERVER_E_DATANOTFOUND},
  56. {TLS_E_SERVERLOOKUP, LSERVER_E_DATANOTFOUND},
  57. {TLS_E_NO_LICENSE, LSERVER_E_NO_LICENSE},
  58. {TLS_E_PRODUCT_NOTINSTALL, LSERVER_E_NO_PRODUCT},
  59. //{TLS_E_LICENSE_REJECTED, LSERVER_E_LICENSE_REJECTED},
  60. //{TLS_E_LICENSE_REVOKED, LSERVER_E_LICENSE_REVOKED},
  61. {TLS_E_CORRUPT_DATABASE, LSERVER_E_CORRUPT_DATABASE},
  62. {TLS_E_LICENSE_EXPIRED, LSERVER_E_LICENSE_EXPIRED},
  63. {TLS_I_LICENSE_UPGRADED, LSERVER_I_LICENSE_UPGRADED},
  64. {TLS_E_NOTSUPPORTED, LSERVER_E_NOTSUPPORTED},
  65. {TLS_E_NO_CERTIFICATE, LSERVER_E_NO_CERTIFICATE},
  66. {TLS_W_REMOVE_TOOMANY, LSERVER_I_REMOVE_TOOMANY},
  67. {TLS_E_DECODE_KEYPACKBLOB, LSERVER_E_INVALID_DATA},
  68. {TLS_W_SELFSIGN_CERTIFICATE, LSERVER_I_SELFSIGN_CERTIFICATE},
  69. {TLS_W_TEMP_SELFSIGN_CERT, LSERVER_I_TEMP_SELFSIGN_CERT},
  70. {TLS_E_CH_INSTALL_NON_LSCERTIFICATE, LSERVER_E_NOT_LSCERTIFICATE},
  71. {TLS_E_POLICYMODULEERROR, LSERVER_E_POLICYMODULEERROR},
  72. {TLS_E_POLICYMODULEEXCEPTION, LSERVER_E_POLICYMODULEERROR},
  73. {TLS_E_INCOMPATIBLEVERSION, LSERVER_E_INCOMPATIBLE},
  74. {TLS_E_INVALID_SPK, LSERVER_E_INVALID_SPK},
  75. {TLS_E_INVALID_LKP, LSERVER_E_INVALID_LKP},
  76. {TLS_E_SPK_INVALID_SIGN, LSERVER_E_INVALID_SIGN},
  77. {TLS_E_LKP_INVALID_SIGN, LSERVER_E_INVALID_SIGN},
  78. {TLS_E_NOPOLICYMODULE, LSERVER_E_NOPOLICYMODULE},
  79. {TLS_E_POLICYERROR, LSERVER_E_POLICYDENYREQUEST}
  80. };
  81. static numMapReturnCode=sizeof(MapReturnCode)/sizeof(MapReturnCode[0]);
  82. DWORD fStatus;
  83. for(int i=0; i < numMapReturnCode && MapReturnCode[i].dwErrCode != dwCode; i++);
  84. if(i >= numMapReturnCode)
  85. {
  86. fStatus = dwCode;
  87. // DebugBreak();
  88. }
  89. else
  90. {
  91. fStatus = MapReturnCode[i].dwReturnCode;
  92. }
  93. return fStatus;
  94. }