Esempio n. 1
0
        public NtStatus FindStreams(string filename, out IList <FileInformation> streams, DokanFileInfo info)
        {
            CacheEntry entry = cache_.Lookup(filename);

            NtStatus ret = 0;

            if (entry.FindStreamsRet == NtStatus.MaximumNtStatus)
            {
                ret = ope_.FindStreams(filename, out streams, info);
                entry.FindStreamsRet   = ret;
                entry.FindStreamsValue = streams;
            }
            else
            {
                streams = new List <FileInformation>();
                IList <FileInformation> cfiles = entry.FindStreamsValue;
                foreach (FileInformation e in cfiles)
                {
                    streams.Add(e);
                }

                ret = entry.FindStreamsRet;
            }
            return(ret);
        }
Esempio n. 2
0
        ////

        internal NtStatus FindStreamsProxy(string rawFileName, IntPtr rawFillFindData, DokanFileInfo rawFileInfo)
        {
            try
            {
                IList <FileInformation> files;

                NtStatus result = _operations.FindStreams(rawFileName, out files, rawFileInfo);

                if (result == DokanResult.Success && files.Count != 0)
                {
                    var fill =
                        (FILL_FIND_STREAM_DATA)Marshal.GetDelegateForFunctionPointer(rawFillFindData, typeof(FILL_FIND_STREAM_DATA));
                    // used a single entry call to speed up the "enumeration" of the list
                    for (int index = 0; index < files.Count; index++)
                    {
                        Addto(fill, rawFileInfo, files[index]);
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                ServiceRegistration.Get <ILogger>().Warn("Dokan exception: ", ex);
                return(DokanResult.InvalidParameter);
            }
        }
        public NtStatus FindStreamsProxy(string rawFileName,
                                         IntPtr rawFillFindData,
                                         DokanFileInfo rawFileInfo)
        {
            try
            {
                IList <FileInformation> files;

                Trace("\nFindStreamsProxy: " + rawFileName);
                Trace("\tContext\t" + ToTrace(rawFileInfo));

                NtStatus result = operations.FindStreams(rawFileName, out files, rawFileInfo);

                Debug.Assert(files != null);
                if (result == DokanResult.Success && files.Count != 0)
                {
                    foreach (FileInformation fi in files)
                    {
                        Trace("\n\tFileName\t" + fi.FileName);
                        Trace("\tLength\t" + fi.Length);
                    }

                    var fill =
                        (FILL_FIND_STREAM_DATA)Marshal.GetDelegateForFunctionPointer(rawFillFindData, typeof(FILL_FIND_STREAM_DATA));
                    // used a single entry call to speed up the "enumeration" of the list
                    for (int index = 0; index < files.Count; index++)
                    {
                        Addto(fill, rawFileInfo, files[index]);
                    }
                }

                Trace("FindStreamsProxy : " + rawFileName + " Return : " + result);
                return(result);
            }
#pragma warning disable 0168
            catch (Exception ex)
#pragma warning restore 0168
            {
                Trace("FindStreamsProxy : " + rawFileName + " Throw : " + ex.Message);
                return(DokanResult.InvalidParameter);
            }
        }
Esempio n. 4
0
        public NtStatus FindStreamsProxy(string rawFileName,
                                         IntPtr rawFillFindData,
                                         DokanFileInfo rawFileInfo)
        {
            try
            {
                IList <FileInformation> files;

                logger.Debug("FindStreamsProxy: {0}", rawFileName);
                logger.Debug("\tContext\t{0}", rawFileInfo);

                var result = operations.FindStreams(rawFileName, out files, rawFileInfo);

                Debug.Assert(!(result == DokanResult.NotImplemented && files == null));
                if (result == DokanResult.Success && files.Count != 0)
                {
                    foreach (var fi in files)
                    {
                        logger.Debug("\tFileName\t{0}", fi.FileName);
                        logger.Debug("\t\tLength\t{0}", fi.Length);
                    }

                    var fill =
                        (FILL_FIND_STREAM_DATA)
                        Marshal.GetDelegateForFunctionPointer(rawFillFindData, typeof(FILL_FIND_STREAM_DATA));
                    // used a single entry call to speed up the "enumeration" of the list
                    foreach (var t in files)
                    {
                        Addto(fill, rawFileInfo, t);
                    }
                }

                logger.Debug("FindStreamsProxy : {0} Return : {1}", rawFileName, result);
                return(result);
            }
            catch (Exception ex)
            {
                logger.Error("FindStreamsProxy : {0} Throw : {1}", rawFileName, ex.Message);
                return(DokanResult.InvalidParameter);
            }
        }