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
2.1 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1992.
  5. //
  6. // File: StgVarB.cxx
  7. //
  8. // Contents: C++ Base wrapper for PROPVARIANT.
  9. //
  10. // History: 01-Aug-94 KyleP Created
  11. // 31-Jul-96 MikeHill - Relaxed assert in IsUnicodeString.
  12. // - Allow NULL strings.
  13. //
  14. //--------------------------------------------------------------------------
  15. #include <pch.cxx>
  16. #include "debtrace.hxx"
  17. #include <propset.h>
  18. #include <propvar.h>
  19. // These optionally-compiled directives tell the compiler & debugger
  20. // where the real file, rather than the copy, is located.
  21. #ifdef _ORIG_FILE_LOCATION_
  22. #if __LINE__ != 25
  23. #error File heading has change size
  24. #else
  25. #line 29 "\\nt\\private\\dcomidl\\stgvarb.cxx"
  26. #endif
  27. #endif
  28. #if DBGPROP
  29. BOOLEAN
  30. IsUnicodeString(WCHAR const *pwszname, ULONG cb)
  31. {
  32. if (cb != 0)
  33. {
  34. for (ULONG i = 0; pwszname[i] != L'\0'; i++)
  35. {
  36. }
  37. // If cb isn't MAXULONG we verify that cb is at least as
  38. // big as the string. We can't check for equality, because
  39. // there are some property sets in which the length field
  40. // for a string may include several zero padding bytes.
  41. PROPASSERT(cb == MAXULONG || (i + 1) * sizeof(WCHAR) <= cb);
  42. }
  43. return(TRUE);
  44. }
  45. BOOLEAN
  46. IsAnsiString(CHAR const *pszname, ULONG cb)
  47. {
  48. if (cb != 0)
  49. {
  50. // If the string is NULL, then it's not not an Ansi string,
  51. // so we'll call it an Ansi string.
  52. if( NULL == pszname )
  53. return( TRUE );
  54. for (ULONG i = 0; pszname[i] != '\0'; i++)
  55. {
  56. }
  57. // If cb isn't MAXULONG we verify that cb is at least as
  58. // big as the string. We can't check for equality, because
  59. // there are some property sets in which the length field
  60. // for a string may include several zero padding bytes.
  61. PROPASSERT(cb == MAXULONG || i + 1 <= cb);
  62. }
  63. return(TRUE);
  64. }
  65. #endif
  66. #endif //ifdef WINNT