Example #1
0
        public Int32 HNC_NetFileGetDirInfo(String dirname, ncfind_t[] info, ref UInt16 num)
        {
            Int32  size = Marshal.SizeOf(typeof(ncfind_t));
            IntPtr ptr  = Marshal.AllocHGlobal(size * info.Length);
            Int32  ret  = -1;

            ret = HncApi.HNC_NetFileGetDirInfo(dirname, ptr, ref num, _ClientNo);

            if (ret == 0)
            {
                for (Int32 i = 0; i < num; ++i)
                {
                    info[i] = (ncfind_t)Marshal.PtrToStructure((IntPtr)(ptr.ToInt32() + i * size), typeof(ncfind_t));
                }
            }

            Marshal.FreeHGlobal(ptr);
            return(ret);
        }