示例#1
0
        public static FileHandle OpenHandle(string hostname)
        {
            IntPtr pHandle;
            int    dwError = SharesAPI.OpenHandle(hostname, out pHandle);

            if (dwError == 0)
            {
                return(new FileHandle(pHandle));
            }
            else
            {
                throw new Exception(String.Format(
                                        "Error: OpenFileHandle [Code:{0}]", dwError));
            }
        }
示例#2
0
 private void CloseHandle()
 {
     try
     {
         if (Configurations.currentPlatform == LikewiseTargetPlatform.Windows)
         {
             SharesAPI.NetApiBufferFree(_handle);
         }
         else
         {
             //if (_handle != IntPtr.Zero)
             //SharesAPI.SrvSvcFreeMemory(_handle);
         }
         _handle = IntPtr.Zero;
     }
     catch { _handle = IntPtr.Zero; }
 }