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.

68 lines
1.4 KiB

  1. //=============================================================================
  2. //
  3. // MODULE: ASN1Value.cxx
  4. //
  5. // Description:
  6. //
  7. // Implementation of ASN1VALUE methods
  8. //
  9. // Modification History
  10. //
  11. // Mark Pustilnik Date: 06/12/02 - Created
  12. //
  13. //=============================================================================
  14. #include "ASN1Parser.hxx"
  15. ASN1VALUE::~ASN1VALUE()
  16. {
  17. Purge();
  18. delete SubParser;
  19. }
  20. ASN1VALUE *
  21. ASN1VALUE::Clone()
  22. {
  23. DWORD dw;
  24. ASN1VALUE * Value = new ASN1VALUE;
  25. if ( Value )
  26. {
  27. RtlCopyMemory(
  28. Value,
  29. this,
  30. sizeof( ASN1VALUE )
  31. );
  32. if ( Value->ut == utOctetString ||
  33. Value->ut == utGeneralString )
  34. {
  35. Value->string.s = new BYTE[string.l];
  36. if ( Value->string.s )
  37. {
  38. RtlCopyMemory(
  39. Value->string.s,
  40. string.s,
  41. string.l
  42. );
  43. Value->Allocated = TRUE;
  44. }
  45. else
  46. {
  47. Value->Allocated = FALSE;
  48. delete Value;
  49. Value = NULL;
  50. }
  51. }
  52. //
  53. // Deep copy of subparser is not safe until parser objects are refcounted
  54. //
  55. Value->SubParser = NULL;
  56. }
  57. return Value;
  58. }