/// <summary>
        /// Create File, named pipe, directory. One transport can only create one file.
        /// </summary>
        /// <param name="fileName">The file, namedpipe, directory name</param>
        /// <param name="desiredAccess">The desired access</param>
        /// <param name="impersonationLevel">The impersonation level</param>
        /// <param name="fileAttribute">The file attribute, this field is only valid when create file.
        /// </param>
        /// <param name="createDisposition">Defines the action the server MUST take if the file that is
        /// specified in the name field already exists</param>
        /// <param name="createOption">Specifies the options to be applied when creating or opening the file</param>
        /// <exception cref="ArgumentException">
        /// createOption can not contain FILE_DIRECTORY_FILE when creating file.
        /// </exception>
        /// <exception cref="System.InvalidOperationException">Thrown if there is any error occurred</exception>
        public override void Create(string fileName,
                                    FsFileDesiredAccess desiredAccess, FsImpersonationLevel impersonationLevel,
                                    FsFileAttribute fileAttribute, FsCreateDisposition createDisposition, FsCreateOption createOption)
        {
            if ((createOption & FsCreateOption.FILE_DIRECTORY_FILE) == FsCreateOption.FILE_DIRECTORY_FILE)
            {
                throw new ArgumentException(
                          "createOption can not contain FILE_DIRECTORY_FILE when creating file.", "createOption");
            }

            InternalCreate(
                fileName,
                (NtTransactDesiredAccess)desiredAccess,
                (NtTransactImpersonationLevel)impersonationLevel,
                (SMB_EXT_FILE_ATTR)fileAttribute,
                (NtTransactCreateDisposition)createDisposition,
                (NtTransactCreateOptions)createOption);
        }
 /// <summary>
 /// Create File, named pipe, directory. One transport can only create one file.
 /// </summary>
 /// <param name="fileName">The file, namedpipe, directory name</param>
 /// <param name="desiredAccess">The desired access</param>
 /// <param name="impersonationLevel">The impersonation level</param>
 /// <param name="fileAttribute">The file attribute, this field is only valid when create file.
 /// </param>
 /// <param name="createDisposition">Defines the action the server MUST take if the file that is
 /// specified in the name field already exists</param>
 /// <param name="createOption">Specifies the options to be applied when creating or opening the file</param>
 /// <exception cref="System.InvalidOperationException">Thrown if there is any error occurred</exception>
 public abstract void Create(string fileName, FsFileDesiredAccess desiredAccess, FsImpersonationLevel impersonationLevel,
                             FsFileAttribute fileAttribute, FsCreateDisposition createDisposition, FsCreateOption createOption);
        /// <summary>
        /// Create a file with create context
        /// </summary>
        /// <param name="fileName">Name of the file</param>
        /// <param name="desiredAccess">The desired access</param>
        /// <param name="shareAccess">Sharing mode for the open</param>
        /// <param name="impersonationLevel">The impersonation level</param>
        /// <param name="fileAttribute">The file attribute, this field is only valid when create file.</param>
        /// <param name="createDisposition">Defines the action the server MUST take if the file that is specified in the name field already exists</param>
        /// <param name="createOption">Specifies the options to be applied when creating or opening the file</param>
        /// <param name="contextRequest">Create contexts to be sent in the create request</param>
        /// <param name="status">Status of the response packet</param>
        /// <param name="serverCreateContexts">Create contexts to be received in the create response</param>
        /// <param name="contextResponse">Create response payload to be received in the create response</param>
        public void Create(
            string fileName,
            FsFileDesiredAccess desiredAccess,
            ShareAccess_Values shareAccess,
            FsImpersonationLevel impersonationLevel,
            FsFileAttribute fileAttribute,
            FsCreateDisposition createDisposition,
            FsCreateOption createOption,
            Smb2CreateContextRequest[] contextRequest,
            out uint status,
            out Smb2CreateContextResponse[] serverCreateContexts,
            out CREATE_Response createResponse)
        {
            if (createOption.HasFlag(FsCreateOption.FILE_DIRECTORY_FILE))
            {
                throw new ArgumentException("createOption can not contain FILE_DIRECTORY_FILE when creating file.");
            }

            Packet_Header header;

            status = client.Create(
                        1,
                        1,
                        headerFlags,
                        messageId++,
                        sessionId,
                        treeId,
                        fileName,
                        (AccessMask)desiredAccess,
                        shareAccess,
                        (CreateOptions_Values)createOption,
                        (CreateDisposition_Values)createDisposition,
                        (File_Attributes)fileAttribute,
                        (ImpersonationLevel_Values)impersonationLevel,
                        SecurityFlags_Values.NONE,
                        RequestedOplockLevel_Values.OPLOCK_LEVEL_NONE,
                        contextRequest,
                        out fileId,
                        out serverCreateContexts,
                        out header,
                        out createResponse);
        }
        /// <summary>
        /// Create File, named pipe, directory. One transport can only create one file.
        /// </summary>
        /// <param name="fileName">The file, namedpipe, directory name</param>
        /// <param name="desiredAccess">The desired access</param>
        /// <param name="impersonationLevel">The impersonation level</param>
        /// <param name="fileAttribute">The file attribute, this field is only valid when create file.
        /// </param>
        /// <param name="createDisposition">Defines the action the server MUST take if the file that is
        /// specified in the name field already exists</param>
        /// <param name="createOption">Specifies the options to be applied when creating or opening the file</param>
        /// <exception cref="System.InvalidOperationException">Thrown if there is any error occurred</exception>
        public override void Create(string fileName, FsFileDesiredAccess desiredAccess, FsImpersonationLevel impersonationLevel,
            FsFileAttribute fileAttribute, FsCreateDisposition createDisposition, FsCreateOption createOption)
        {
            if (createOption.HasFlag(FsCreateOption.FILE_DIRECTORY_FILE))
            {
                throw new ArgumentException("createOption cannot contain FILE_DIRECTORY_FILE when creating file.");
            }

            InternalCreate(fileName, (uint)desiredAccess, impersonationLevel, fileAttribute, createDisposition, createOption);
        }
Example #5
0
 /// <summary>
 /// Create File, named pipe, directory. One transport can only create one file.
 /// </summary>
 /// <param name="fileName">The file, namedpipe, directory name</param>
 /// <param name="desiredAccess">The desired access</param>
 /// <param name="impersonationLevel">The impersonation level</param>
 /// <param name="fileAttribute">The file attribute, this field is only valid when create file.
 /// </param>
 /// <param name="createDisposition">Defines the action the server MUST take if the file that is
 /// specified in the name field already exists</param>
 /// <param name="createOption">Specifies the options to be applied when creating or opening the file</param>
 /// <exception cref="System.InvalidOperationException">Thrown if there is any error occurred</exception>
 public override void Create(string fileName, FsFileDesiredAccess desiredAccess, FsImpersonationLevel impersonationLevel,
                             FsFileAttribute fileAttribute, FsCreateDisposition createDisposition, FsCreateOption createOption)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Create File, named pipe, directory. One transport can only create one file.
 /// </summary>
 /// <param name="fileName">The file, namedpipe, directory name</param>
 /// <param name="desiredAccess">The desired access</param>
 /// <param name="impersonationLevel">The impersonation level</param>
 /// <param name="fileAttribute">The file attribute, this field is only valid when create file.
 /// </param>
 /// <param name="createDisposition">Defines the action the server MUST take if the file that is
 /// specified in the name field already exists</param>
 /// <param name="createOption">Specifies the options to be applied when creating or opening the file</param>
 /// <exception cref="System.InvalidOperationException">Thrown if there is any error occurred</exception>
 public override void Create(string fileName, FsFileDesiredAccess desiredAccess, FsImpersonationLevel impersonationLevel,
     FsFileAttribute fileAttribute, FsCreateDisposition createDisposition, FsCreateOption createOption)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Create File, named pipe, directory. One transport can only create one file.
 /// </summary>
 /// <param name="fileName">The file, namedpipe, directory name</param>
 /// <param name="desiredAccess">The desired access</param>
 /// <param name="impersonationLevel">The impersonation level</param>
 /// <param name="fileAttribute">The file attribute, this field is only valid when create file.
 /// </param>
 /// <param name="createDisposition">Defines the action the server MUST take if the file that is
 /// specified in the name field already exists</param>
 /// <param name="createOption">Specifies the options to be applied when creating or opening the file</param>
 /// <exception cref="System.InvalidOperationException">Thrown if there is any error occurred</exception>
 public abstract void Create(string fileName, FsFileDesiredAccess desiredAccess, FsImpersonationLevel impersonationLevel,
     FsFileAttribute fileAttribute, FsCreateDisposition createDisposition, FsCreateOption createOption);
        /// <summary>
        /// Create File, named pipe, directory. One transport can only create one file.
        /// </summary>
        /// <param name="fileName">The file, namedpipe, directory name</param>
        /// <param name="desiredAccess">The desired access</param>
        /// <param name="impersonationLevel">The impersonation level</param>
        /// <param name="fileAttribute">The file attribute, this field is only valid when create file.
        /// </param>
        /// <param name="createDisposition">Defines the action the server MUST take if the file that is
        /// specified in the name field already exists</param>
        /// <param name="createOption">Specifies the options to be applied when creating or opening the file</param>
        /// <exception cref="ArgumentException">
        /// createOption can not contain FILE_DIRECTORY_FILE when creating file.
        /// </exception>
        /// <exception cref="System.InvalidOperationException">Thrown if there is any error occurred</exception>
        public override void Create(string fileName,
            FsFileDesiredAccess desiredAccess, FsImpersonationLevel impersonationLevel,
            FsFileAttribute fileAttribute, FsCreateDisposition createDisposition, FsCreateOption createOption)
        {
            if ((createOption & FsCreateOption.FILE_DIRECTORY_FILE) == FsCreateOption.FILE_DIRECTORY_FILE)
            {
                throw new ArgumentException(
                    "createOption can not contain FILE_DIRECTORY_FILE when creating file.", "createOption");
            }

            InternalCreate(
                fileName,
                (NtTransactDesiredAccess)desiredAccess,
                (NtTransactImpersonationLevel)impersonationLevel,
                (SMB_EXT_FILE_ATTR)fileAttribute,
                (NtTransactCreateDisposition)createDisposition,
                (NtTransactCreateOptions)createOption);
        }