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.

80 lines
1.7 KiB

  1. /* Copyright (C) Boris Nikolaus, Germany, 1996-1997. All rights reserved. */
  2. /* Copyright (C) Microsoft Corporation, 1997-1998. All rights reserved. */
  3. //--------------------------------------------------------------------------
  4. //
  5. // Module Name: ms_core.h
  6. //
  7. // Brief Description:
  8. // This module contains the engine for the Microsoft
  9. // ASN.1 encoder and decoder.
  10. //
  11. // History:
  12. // 10/15/97 Lon-Chan Chu (lonchanc)
  13. // Created.
  14. //
  15. // Copyright (c) 1997 Microsoft Corporation
  16. //
  17. //--------------------------------------------------------------------------
  18. #include "precomp.h"
  19. int APIENTRY
  20. DllMain ( HINSTANCE hInstance, DWORD dwReason, LPVOID plReserved )
  21. {
  22. switch (dwReason)
  23. {
  24. case DLL_PROCESS_ATTACH:
  25. DisableThreadLibraryCalls(hInstance);
  26. break;
  27. case DLL_PROCESS_DETACH:
  28. #ifdef ENABLE_MEMORY_TRACKING
  29. DbgMemTrackFinalCheck();
  30. #endif // ENABLE_MEMORY_TRACKING
  31. break;
  32. default:
  33. break;
  34. }
  35. return TRUE;
  36. }
  37. ASN1error_e ASN1EncSetError(ASN1encoding_t enc, ASN1error_e err)
  38. {
  39. ASN1INTERNencoding_t e = (ASN1INTERNencoding_t) enc;
  40. EncAssert(enc, ASN1_SUCCESS <= err);
  41. while (e)
  42. {
  43. e->info.err = err;
  44. if (e == e->parent)
  45. {
  46. break;
  47. }
  48. e = e->parent;
  49. }
  50. return err;
  51. }
  52. ASN1error_e ASN1DecSetError(ASN1decoding_t dec, ASN1error_e err)
  53. {
  54. ASN1INTERNdecoding_t d = (ASN1INTERNdecoding_t) dec;
  55. DecAssert(dec, ASN1_SUCCESS <= err);
  56. while (d)
  57. {
  58. d->info.err = err;
  59. if (d == d->parent)
  60. {
  61. break;
  62. }
  63. d = d->parent;
  64. }
  65. return err;
  66. }