示例#1
0
 public static extern SafeFileHandle CreateFile(
     [MarshalAs(UnmanagedType.LPTStr)] string lpFileName,
     [MarshalAs(UnmanagedType.U4)] EFileAccess dwDesiredAccess,
     [MarshalAs(UnmanagedType.U4)] EFileShare dwShareMode,
     IntPtr lpSecurityAttributes, // optional SECURITY_ATTRIBUTES struct or IntPtr.Zero
     [MarshalAs(UnmanagedType.U4)] ECreationDisposition dwCreationDisposition,
     [MarshalAs(UnmanagedType.U4)] EFileAttributes dwFlagsAndAttributes,
     IntPtr hTemplateFile);
示例#2
0
		private static extern IntPtr CreateFile(
			string lpFileName,
			EFileAccess dwDesiredAccess,
			EFileShare dwShareMode,
			IntPtr lpSecurityAttributes,
			ECreationDisposition dwCreationDisposition,
			EFileAttributes dwFlagsAndAttributes,
			IntPtr hTemplateFile);
示例#3
0
 public static extern SafeFileHandle CreateFile(
     string lpFileName,
     EFileAccess dwDesiredAccess,
     EFileShare dwShareMode,
     IntPtr lpSecurityAttributes,
     ECreationDisposition dwCreationDisposition,
     EFileAttributes dwFlagsAndAttributes,
     SafeFileHandle hTemplateFile);
示例#4
0
 internal static extern SafeFileHandle CreateFile(
     string fileName,
     [MarshalAs(UnmanagedType.U4)] EFileAccess fileAccess,
     [MarshalAs(UnmanagedType.U4)] EFileShare shareMode,
     IntPtr securityAttributes,
     [MarshalAs(UnmanagedType.U4)] ECreationDisposition creationDisposition,
     EFileAttributes flagsAndAttributes,
     SafeFileHandle templateFile);
示例#5
0
 private static extern IntPtr CreateFile(
     [MarshalAs(UnmanagedType.LPTStr)] string lpFileName,
     [MarshalAs(UnmanagedType.U4)] EFileAccess dwDesiredAccess,
     [MarshalAs(UnmanagedType.U4)] EFileShare dwShareMode,
     [MarshalAs(UnmanagedType.SysInt)] IntPtr lpSecurityAttributes,
     [MarshalAs(UnmanagedType.U4)] ECreationDisposition dwCreationDisposition,
     [MarshalAs(UnmanagedType.U4)] EFileAttributes dwFlagsAndAttributes,
     [MarshalAs(UnmanagedType.U4)] uint hTemplateFile);
示例#6
0
 internal static unsafe extern IntPtr CreateFile(
     string lpFileName,
     [MarshalAs(UnmanagedType.U4)] FileAccess dwDesiredAccess,
     [MarshalAs(UnmanagedType.U4)] FileShare dwShareMode,
     IntPtr lpSecurityAttributes,
     [MarshalAs(UnmanagedType.U4)] FileMode dwCreationDisposition,
     [MarshalAs(UnmanagedType.U4)] EFileAttributes dwFlagsAndAttributes,
     IntPtr hTemplateFile);
示例#7
0
 public static extern SafeFileHandle CreateFile(
     [In][MarshalAs(UnmanagedType.LPWStr)] string filename,
     [In][MarshalAs(UnmanagedType.U4)] EFileAccess dwDesiredAccess,
     [In][MarshalAs(UnmanagedType.U4)] EFileShare dwShareMode,
     [In, Optional] IntPtr lpSecurityAttributes,
     [In][MarshalAs(UnmanagedType.U4)] ECreationDisposition dwCreationDisposition,
     [In][MarshalAs(UnmanagedType.U4)] EFileAttributes dwFlagsAndAttributes,
     [In, Optional] IntPtr hTemplateFile);
 internal static extern IntPtr CreateFile(
     string fileName,
     [MarshalAs(UnmanagedType.U4)] UInt32 fileAccess,
     [MarshalAs(UnmanagedType.U4)] UInt32 fileShare,
     IntPtr securityAttributes,
     [MarshalAs(UnmanagedType.U4)] UInt32 creationDisposition,
     [MarshalAs(UnmanagedType.U4)] EFileAttributes flags,
     IntPtr template);
示例#9
0
 public static extern SafeFileHandle CreateFile(
     /* [in] */ [MarshalAs(UnmanagedType.LPWStr)] string fileName,
     /* [in] */ [MarshalAs(UnmanagedType.U4)] EFileAccess desiredAccess,
     /* [in] */ [MarshalAs(UnmanagedType.U4)] FileShare shareMode,
     /* [in] */ IntPtr securityAttributes,
     /* [in] */ [MarshalAs(UnmanagedType.U4)] FileMode createMode,
     /* [in] */ [MarshalAs(UnmanagedType.U4)] EFileAttributes flagsAndAttributes,
     /* [in] */ IntPtr templateFile);
示例#10
0
 public static extern IntPtr CreateFileW(
     [MarshalAs(UnmanagedType.LPWStr)] string filename,
     [MarshalAs(UnmanagedType.U4)] EFileAccess access,
     [MarshalAs(UnmanagedType.U4)] EFileShare share,
     IntPtr securityAttributes,
     [MarshalAs(UnmanagedType.U4)] ECreationDisposition creationDisposition,
     [MarshalAs(UnmanagedType.U4)] EFileAttributes flagsAndAttributes,
     IntPtr templateFile);
示例#11
0
 internal static extern SafeFileHandle CreateFile(
     string lpFileName,
     EFileAccess dwDesiredAccess,
     EFileShare dwShareMode,
     ref SECURITY_ATTRIBUTES lpSecurityAttributes,
     ECreationDisposition dwCreationDisposition,
     EFileAttributes dwFlagsAndAttributes,
     IntPtr hTemplateFile);
示例#12
0
 public static extern IntPtr CreateFile(
     [MarshalAs(UnmanagedType.LPTStr)] string filename,
     [MarshalAs(UnmanagedType.U4)] EFileAccess access,
     [MarshalAs(UnmanagedType.U4)] EFileShare share,
     IntPtr securityAttributes, // optional SECURITY_ATTRIBUTES struct or IntPtr.Zero
     [MarshalAs(UnmanagedType.U4)] ECreationDisposition creationDisposition,
     [MarshalAs(UnmanagedType.U4)] EFileAttributes flagsAndAttributes,
     IntPtr templateFile);
示例#13
0
 public static extern SafeFileHandle CreateFile(
     string fileName,
     [MarshalAs(UnmanagedType.U4)] FileAccess fileAccess,
     [MarshalAs(UnmanagedType.U4)] FileShare fileShare,
     IntPtr securityAttributes,
     [MarshalAs(UnmanagedType.U4)] FileMode creationDisposition,
     [MarshalAs(UnmanagedType.U4)] EFileAttributes flags,
     IntPtr template);
示例#14
0
 private static extern IntPtr CreateFile(
     string lpFileName,
     EFileAccess dwDesiredAccess,
     EFileShare dwShareMode,
     IntPtr lpSecurityAttributes,
     ECreationDisposition dwCreationDisposition,
     EFileAttributes dwFlagsAndAttributes,
     IntPtr hTemplateFile);
示例#15
0
 private static extern IntPtr CreateFile(
     string fileName,
     EFileAccess fileAccess,
     EFileShare fileShare,
     IntPtr securityAttributes,
     ECreationDisposition creationDisposition,
     EFileAttributes flags,
     IntPtr template);
示例#16
0
 public static extern SafeFileHandle CreateFile(
       string lpFileName,
       EFileAccess dwDesiredAccess,
       EFileShare dwShareMode,
       IntPtr SecurityAttributes,
       ECreationDisposition dwCreationDisposition,
       EFileAttributes dwFlagsAndAttributes,
       IntPtr hTemplateFile
       );
示例#17
0
        /// <summary>
        /// Tries to get the file attributes.
        /// </summary>
        /// <param name="normalizedPath">Normalized path to file or directory.</param>
        /// <param name="attributes">Attributes found.</param>
        /// <returns><see langword="true"/>, if the file or directory attributes were successfully retrieved; otherwise, <see langword="false"/>.</returns>
        private static bool TryGetFileAttributes(string normalizedPath, out EFileAttributes attributes)
        {
            // NOTE: Don't be tempted to use FindFirstFile here, it does not work with root directories.
            attributes = NativeMethods.GetFileAttributes(normalizedPath);
            if (attributes == EFileAttributes.Invalid)
            {
                return(false);
            }

            return(true);
        }
示例#18
0
 internal static extern SafeFileHandle CreateFileTransacted(
     [In, MarshalAs(UnmanagedType.LPWStr)] string lpFileName,
     [In] WindowsNative.FileAccess dwDesiredAccess,
     [In] WindowsNative.FileShare dwShareMode,
     [In] IntPtr lpSecurityAttributes,
     [In] WindowsNative.FileMode dwCreationDisposition,
     [In] EFileAttributes dwFlagsAndAttributes,
     [In] IntPtr hTemplateFile,
     [In] KtmTransactionHandle hTransaction,
     [In] IntPtr pusMiniVersion,
     [In] IntPtr pExtendedParameter);
示例#19
0
 public CFileDescriptorBlock(CBackupStream Reader)
 {
     base.ReadData(Reader);
     FileAttributes       = (EFileAttributes)Reader.ReadUInt32();
     LastModificationDate = Reader.ReadDate();
     CreationDate         = Reader.ReadDate();
     BackupDate           = Reader.ReadDate();
     LastAccessDate       = Reader.ReadDate();
     DirectoryID          = Reader.ReadUInt32();
     FileID   = Reader.ReadUInt32();
     FileName = Reader.ReadString(StartPosition, StringType);
     base.ReadStreams(Reader);
 }
示例#20
0
        //
        // These are wrappers that translate error codes
        // into exceptions to make error handling easier
        //
        private static IntPtr CreateFileNet(
            string lpFileName,
            EFileAccess dwDesiredAccess,
            EFileShare dwShareMode,
            IntPtr lpSecurityAttributes,
            ECreationDisposition dwCreationDisposition,
            EFileAttributes dwFlagsAndAttributes,
            IntPtr hTemplateFile)
        {
            IntPtr ret = CreateFile(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);

            //If == INVALID_HANDLE_VALUE
            if (ret.ToInt32() == -1)
            {
                Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
            }
            return(ret);
        }
示例#21
0
        public static IntPtr _CreateFile(
            string lpFileName,
            EFileAccess dwDesiredAccess,
            EFileShare dwShareMode,
            ECreationDisposition dwCreationDisposition,
            EFileAttributes dwFlagsAndAttributes,
            IntPtr hTemplateFile
            )
        {
            SECURITY_DESCRIPTOR sd = new SECURITY_DESCRIPTOR();

            InitializeSecurityDescriptor(ref sd, SECURITY_DESCRIPTOR_REVISION);
            SetSecurityDescriptorDacl(ref sd, true, IntPtr.Zero, false);
            GCHandle sdHandle = GCHandle.Alloc(sd, GCHandleType.Pinned);

            SECURITY_ATTRIBUTES sa = new SECURITY_ATTRIBUTES();

            sa.nLength = Marshal.SizeOf(sa);
            sa.lpSecurityDescriptor = sdHandle.AddrOfPinnedObject();
            sa.bInheritHandle       = 0;
            GCHandle saHandle = GCHandle.Alloc(sa, GCHandleType.Pinned);

            System.IntPtr hFile = IntPtr.Zero;
            hFile = CreateFile(
                lpFileName,
                dwDesiredAccess,
                dwShareMode,
                saHandle.AddrOfPinnedObject(),
                dwCreationDisposition,
                dwFlagsAndAttributes,
                hTemplateFile
                );

            saHandle.Free();
            sdHandle.Free();
            if (hFile == (System.IntPtr)(int) - 1)
            {
                return(IntPtr.Zero);
            }
            return(hFile);
        }
示例#22
0
 public static extern IntPtr CreateFile(String lpFileName, FileAccess dwDesiredAccess, FileShare shareMode, IntPtr securityAttributes, FileMode dwCreationDispostion, EFileAttributes dwFlagsAndAttributes,
                                        int hTemplateFile);
示例#23
0
        /// <summary>
        /// Opens a System.IO.FileStream on the specified path with read/write access.
        /// </summary>
        /// <param name="myPath">The file to open.</param>
        /// <param name="myFileMode">A System.IO.FileMode value that specifies whether a file is created if one
        ///     does not exist, and determines whether the contents of existing files are
        ///     retained or overwritten.</param>
        /// <param name="myFileAccess">A System.IO.FileAccess value that specifies the operations that can be performed
        ///     on the file.</param>
        /// <param name="myFileAttributes">The desired System.IO.FileAttributes, such as Hidden, ReadOnly, Normal, and
        ///     Archive.</param>
        /// <param name="myFileShare">A System.IO.FileShare value specifying the type of access other threads have
        ///     to the file.</param>
        /// <returns>A System.IO.FileStream opened in the specified mode and path, with read/write
        ///     access and not shared.
        /// </returns>
        public static FileStream Open(String myPath, FileMode myFileMode, FileAccess myFileAccess, EFileAttributes myFileAttributes = EFileAttributes.Normal, EFileShare myFileShare = EFileShare.None, Boolean myCreatePathIfNotExists = false)
        {
            #if(__MonoCS__)

            #region CreatePathIfNotExists

            if (myCreatePathIfNotExists && (myFileMode == FileMode.Create || myFileMode == FileMode.CreateNew || myFileMode == FileMode.OpenOrCreate))
            {
                DirectoryHandler.CreatePathIfNotExists(myPath);
            }

            #endregion

            return File.Open(myPath, myFileMode, myFileAccess, (FileShare)myFileShare);

            #else

            myPath = PathHandler.GetFullPathInternal(myPath); // change path to unicode path

            #region CreatePathIfNotExists

            if (myCreatePathIfNotExists && (myFileMode == FileMode.Create || myFileMode == FileMode.CreateNew || myFileMode == FileMode.OpenOrCreate))
            {
                DirectoryHandler.CreatePathIfNotExists(myPath);
            }

            #endregion

            #region ECreationDisposition

            ECreationDisposition creationDisposition = (myFileMode == FileMode.Append) ? ECreationDisposition.OpenAlways : (ECreationDisposition)(int)myFileMode;

            #endregion

            #region EFileAccess

            EFileAccess fileAccess = EFileAccess.GenericAll;
            switch (myFileAccess)
            {
                case FileAccess.Read:
                    fileAccess = EFileAccess.GenericRead;
                    break;
                case FileAccess.ReadWrite:
                    fileAccess = EFileAccess.GenericAll;
                    break;
                case FileAccess.Write:
                    fileAccess = EFileAccess.GenericWrite;
                    break;
                default:
                    fileAccess = EFileAccess.GenericAll;
                    break;
            }

            #endregion

            #region Create the file using the WinAPI32 and check for errors

            var fileHandle = NativeWin32Methods.CreateFileW(myPath, fileAccess, myFileShare, null, creationDisposition, myFileAttributes, IntPtr.Zero);

            // Check for errors
            if (fileHandle.IsInvalid)
            {
                int lastWin32Error = Marshal.GetLastWin32Error();
                throw new System.ComponentModel.Win32Exception(lastWin32Error);
            }

            #endregion

            #region Create FileStream and seek to end if FileMode.Append

            var stream = new FileStream(fileHandle, myFileAccess, 0x1000, false);
            if (myFileMode == FileMode.Append)
            {
                stream.Seek(0, SeekOrigin.End);
            }

            #endregion

            return stream;

            #endif
        }
示例#24
0
文件: FileRef.cs 项目: kevtham/twin
 private static extern IntPtr CreateFile(
    string fileName,
    EFileAccess fileAccess,
    EFileShare fileShare,
    IntPtr securityAttributes,
    ECreationDisposition creationDisposition,
    EFileAttributes flags,
    IntPtr template);
示例#25
0
 private static extern IntPtr CreateFile(string fileName, EFileAccess desiredAccess, EFileShare shareMode, IntPtr securityAttributes, ECreationDisposition creationDisposition, EFileAttributes flagsAndAttributes, IntPtr templateFile);
示例#26
0
        //---------------------------- Rotinas

        //--------------- Cria um Contexto IO para o arquivo
        public static IIOContext CreateIOContext(string ContextName, string FileName, FileAccess DesiredAccess,
                                                 FileShare ShareMode, uint SecurityAttributes, FileMode CreationDisposition, EFileAttributes FlagsAndAttributes)
        {
            int h = CreateFile(FileName, DesiredAccess, ShareMode, SecurityAttributes, CreationDisposition, FlagsAndAttributes);

            IOContext context = new IOContext();

            context.name = ContextName;

            if (h < 0)
            {
                context.handle = new Handle(); //inválido por padrão
                context.result = -h;           //converte o erro de volta para o padrao
            }
            else
            {
                Handle handle = GetHandle(h);
                context.handle = handle;
                context.result = 0;
                Contexts.Add(context);
            }
            return(context);
        }
示例#27
0
 private void *CreateFileHook(string FileName, EFileAccess Access, EFileShare Share, void *SecurityAttributes, ECreationDisposition CreationDisposition, EFileAttributes FlagsAndAttributes, void *TemplateFile)
 {
     FileName = OnCreateFile?.Invoke(FileName);
     return(Bypass(FileName, Access, Share, SecurityAttributes, CreationDisposition, FlagsAndAttributes, TemplateFile));
 }
示例#28
0
        //--------------- Cria/Abre um arquivo ou disco, se houver erro retorna o valor negativo de um erro nativo
        internal static int CreateFile(string FileName, FileAccess DesiredAccess, FileShare ShareMode,
                                       uint SecurityAttributes, FileMode CreationDisposition, EFileAttributes FlagsAndAttributes)
        {
            Handle handle = GetHandle(FileName);

            if (handle != null)
            {
                handle.counter++;
                return(handle.handle);
            }

            int h = CreateFile(FileName, DesiredAccess, ShareMode, SecurityAttributes, CreationDisposition,
                               FlagsAndAttributes, 0);

            if (h == -1)
            {
                int    error = Marshal.GetLastWin32Error();
                string name  = Path.GetFileName(FileName);
                if (name.Length == 0)
                {
                    name = FileName;
                }

                Log.SendMessage(name, (int)IORet.RET_IO_NATIVEERROR, error, LogMessageType.Error);
                return(-error);
            }

            handle        = new Handle();
            handle.name   = FileName;
            handle.handle = h;
            handle.counter++; //Primeira instância do handle
            handle.position = 0;

            int r = SetFilePointerEx(h, 0, ref handle.size, SeekOrigin.End);

            r = Marshal.GetLastWin32Error();

            long dummy = 0;

            SetFilePointerEx(h, 0, ref dummy, SeekOrigin.Begin);

            Handles.Add(handle);

            return(handle.handle);
        }
示例#29
0
 public static extern bool SetFileAttributes(
     /* [in] */ [MarshalAs(UnmanagedType.LPWStr)] string fileName,
     /* [in] */ [MarshalAs(UnmanagedType.U4)] EFileAttributes fileAttributes);
示例#30
0
 private static extern int CreateFile(string lpFileName, FileAccess dwDesiredAccess, FileShare dwShareMode,
                                      uint lpSecurityAttributes, FileMode dwCreationDisposition, EFileAttributes dwFlagsAndAttributes,
                                      uint hTemplateFile);
示例#31
0
        public static IntPtr _CreateFile(
           string lpFileName,
           EFileAccess dwDesiredAccess,
           EFileShare dwShareMode,
           ECreationDisposition dwCreationDisposition,
           EFileAttributes dwFlagsAndAttributes,
           IntPtr hTemplateFile
            )
        {
            SECURITY_DESCRIPTOR sd = new SECURITY_DESCRIPTOR();
            InitializeSecurityDescriptor(ref sd, SECURITY_DESCRIPTOR_REVISION);
            SetSecurityDescriptorDacl(ref sd, true, IntPtr.Zero, false);
            GCHandle sdHandle = GCHandle.Alloc(sd, GCHandleType.Pinned); 

            SECURITY_ATTRIBUTES sa = new SECURITY_ATTRIBUTES();
            sa.nLength = Marshal.SizeOf(sa);
            sa.lpSecurityDescriptor = sdHandle.AddrOfPinnedObject(); 
            sa.bInheritHandle = 0;
            GCHandle saHandle = GCHandle.Alloc(sa, GCHandleType.Pinned); 

            System.IntPtr hFile = IntPtr.Zero;
            hFile = CreateFile(
                lpFileName,
                dwDesiredAccess,
                dwShareMode,
                saHandle.AddrOfPinnedObject(),
                dwCreationDisposition,
                dwFlagsAndAttributes,
                hTemplateFile
            );

            saHandle.Free();
            sdHandle.Free();
            if (hFile == (System.IntPtr)(int)-1)
            {
                return IntPtr.Zero;
            }
            return hFile;
        }
示例#32
0
 /// <summary>
 /// Determines whether the specified attributes belong to a directory.
 /// </summary>
 /// <param name="attributes">File or directory attributes.</param>
 /// <returns><see langword="true"/> if the specified attributes belong to a directory; otherwise, <see langword="false"/>.
 /// </returns>
 internal static bool IsDirectory(EFileAttributes attributes)
 {
     return(attributes.HasFlag(EFileAttributes.Directory));
 }
示例#33
0
 /// <summary>
 /// Determines whether the specified attributes belong to a directory.
 /// </summary>
 /// <param name="attributes">File or directory attributes.</param>
 /// <returns><see langword="true"/> if the specified attributes belong to a directory; otherwise, <see langword="false"/>.
 /// </returns>
 internal static bool IsDirectory(EFileAttributes attributes)
 {
     return attributes.HasFlag(EFileAttributes.Directory);
 }
示例#34
0
 public static extern IntPtr BoxedAppSDK_CreateVirtualFileBasedOnIStream(string lpFileName, EFileAccess dwDesiredAccess, EFileShare dwShareMode, IntPtr lpSecurityAttributes, ECreationDisposition dwCreationDisposition, EFileAttributes dwFlagsAndAttributes, IntPtr hTemplateFile, IStream Stream);
示例#35
0
 public static extern IntPtr CreateFile(string filename, EFileAccess desiredAccess, EFileShare shareMode, IntPtr securityAttributes,
     ECreationDisposition creationDisposition, EFileAttributes attributes, IntPtr template);
示例#36
0
        /// <summary>
        /// Tries to get the file attributes.
        /// </summary>
        /// <param name="normalizedPath">Normalized path to file or directory.</param>
        /// <param name="attributes">Attributes found.</param>
        /// <returns><see langword="true"/>, if the file or directory attributes were successfully retrieved; otherwise, <see langword="false"/>.</returns>
        private static bool TryGetFileAttributes(string normalizedPath, out EFileAttributes attributes)
        {
            // NOTE: Don't be tempted to use FindFirstFile here, it does not work with root directories.
            attributes = NativeMethods.GetFileAttributes(normalizedPath);
            if (attributes == EFileAttributes.Invalid)
            {
                return false;
            }

            return true;
        }
 private static extern IntPtr CreateFile(string fileName, EFileAccess desiredAccess, EFileShare shareMode, IntPtr securityAttributes, ECreationDisposition creationDisposition, EFileAttributes flagsAndAttributes, IntPtr templateFile);
示例#38
0
 internal static extern IntPtr CreateFile(String lpFileName, UInt32 dwDesiredAccess,
                                          UInt32 dwShareMode, IntPtr lpSecurityAttributes, UInt32 dwCreationDisposition,
                                          EFileAttributes fileAttrs, IntPtr hTemplateFile);
示例#39
0
 public CFileDescriptorBlock(CBackupStream Reader)
 {
     base.ReadData(Reader);
     FileAttributes = (EFileAttributes)Reader.ReadUInt32();
     LastModificationDate = Reader.ReadDate();
     CreationDate = Reader.ReadDate();
     BackupDate = Reader.ReadDate();
     LastAccessDate = Reader.ReadDate();
     DirectoryID = Reader.ReadUInt32();
     FileID = Reader.ReadUInt32();
     FileName = Reader.ReadString(StartPosition, StringType);
     base.ReadStreams(Reader);
 }
示例#40
0
 public static extern IntPtr CreateFile(string filename, EFileAccess desiredAccess,
                                        EFileShare shareMode, IntPtr securityAttributes,
                                        ECreationDisposition creationDisposition, EFileAttributes attributes, IntPtr template);
示例#41
0
 internal static extern SafeFileHandle CreateFileW(
     string lpFileName,
     EFileAccess dwDesiredAccess,
     EFileShare dwShareMode,
     SECURITY_ATTRIBUTES lpSecurityAttributes,
     ECreationDisposition dwCreationDisposition,
     EFileAttributes dwFlagsAndAttributes,
     IntPtr hTemplateFile);