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.

73 lines
2.0 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // File: query.cxx
  4. //
  5. // Contents: This module contains the functions which deal with queries
  6. // basically, those which help us in getting from an entry path
  7. // to a volume object Name.
  8. //
  9. // History: 24-May-1993 SudK Created.
  10. //
  11. //--------------------------------------------------------------------------
  12. #include "headers.hxx"
  13. #pragma hdrstop
  14. #include "cdfsvol.hxx"
  15. //+-------------------------------------------------------------------------
  16. //
  17. // Function: GetVolObjForPath,
  18. //
  19. // Synopsis: Given an entrypath it returns the volume object which has
  20. // the exact same entry path on it.
  21. //
  22. // Arguments: [pwszEntryPath] -- The Entry Path is given here.
  23. // [fExactMatch] -- If TRUE, then the volume object's entry path
  24. // must match pwszEntryPath exactly.
  25. // [ppwszVolFound] -- The appropriate vol obj name.
  26. //
  27. // Returns:
  28. //
  29. //--------------------------------------------------------------------------
  30. DWORD
  31. GetVolObjForPath(
  32. IN PWSTR pwszEntryPath,
  33. IN BOOLEAN fExactMatch,
  34. OUT PWSTR *ppwszVolFound
  35. )
  36. {
  37. PWCHAR pPrivatePrefix;
  38. ULONG ulen = wcslen(pwszEntryPath);
  39. DWORD dwErr;
  40. if (pDfsmStorageDirectory == NULL) {
  41. return ERROR_INVALID_PARAMETER;
  42. }
  43. //
  44. // Get rid of a trailing backslash if there is one.
  45. //
  46. pPrivatePrefix = new WCHAR[ulen+1];
  47. if (pPrivatePrefix != NULL) {
  48. wcscpy(pPrivatePrefix, pwszEntryPath);
  49. if (ulen >= 1 && pPrivatePrefix[ulen-1] == L'\\')
  50. pPrivatePrefix[ulen-1] = L'\0';
  51. dwErr = pDfsmStorageDirectory->GetObjectForPrefix(
  52. pPrivatePrefix,
  53. fExactMatch,
  54. ppwszVolFound,
  55. &ulen);
  56. delete [] pPrivatePrefix;
  57. } else {
  58. dwErr = ERROR_OUTOFMEMORY;
  59. }
  60. return(dwErr);
  61. }