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.

51 lines
1.3 KiB

  1. //*************************************************************
  2. //
  3. // Copyright (c) Microsoft Corporation 1999 - 2000
  4. // All rights reserved
  5. //
  6. // util.cxx
  7. //
  8. // Contains definitions for utility functions related to
  9. // rsop for use by client side extensions
  10. //
  11. // Created: 10-11-1999 adamed
  12. //
  13. //*************************************************************/
  14. #include "rsop.hxx"
  15. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  16. //
  17. // StripPrefix()
  18. //
  19. // Purpose: Strips out prefix to get canonical path to Gpo
  20. //
  21. // Parameters: pwszPath - full path to the ds object linked
  22. // to the gpo
  23. //
  24. // Returns: Pointer to suffix
  25. //
  26. //-------------------------------------------------------------
  27. WCHAR *StripLinkPrefix( WCHAR *pwszPath )
  28. {
  29. WCHAR wszPrefix[] = TEXT("LDAP://");
  30. INT iPrefixLen = lstrlen( wszPrefix );
  31. WCHAR *pwszPathSuffix;
  32. //
  33. // Strip out prefix to get the canonical path to Som
  34. //
  35. if ( wcslen(pwszPath) <= (DWORD) iPrefixLen ) {
  36. return pwszPath;
  37. }
  38. if ( CompareString( LOCALE_USER_DEFAULT, NORM_IGNORECASE,
  39. pwszPath, iPrefixLen, wszPrefix, iPrefixLen ) == CSTR_EQUAL ) {
  40. pwszPathSuffix = pwszPath + iPrefixLen;
  41. } else
  42. pwszPathSuffix = pwszPath;
  43. return pwszPathSuffix;
  44. }