FileDocCategorySizeDatePackage
SmbComNTCreateAndX.javaAPI DocJCIFS 1.3.17 API6900Tue Oct 18 15:26:24 BST 2011jcifs.smb

SmbComNTCreateAndX

public class SmbComNTCreateAndX extends AndXServerMessageBlock

Fields Summary
static final int
FILE_SUPERSEDE
static final int
FILE_OPEN
static final int
FILE_CREATE
static final int
FILE_OPEN_IF
static final int
FILE_OVERWRITE
static final int
FILE_OVERWRITE_IF
static final int
FILE_WRITE_THROUGH
static final int
FILE_SEQUENTIAL_ONLY
static final int
FILE_SYNCHRONOUS_IO_ALERT
static final int
FILE_SYNCHRONOUS_IO_NONALERT
static final int
SECURITY_CONTEXT_TRACKING
static final int
SECURITY_EFFECTIVE_ONLY
private int
rootDirectoryFid
private int
extFileAttributes
private int
shareAccess
private int
createDisposition
private int
createOptions
private int
impersonationLevel
private long
allocationSize
private byte
securityFlags
private int
namelen_index
int
flags0
int
desiredAccess
Constructors Summary
SmbComNTCreateAndX(String name, int flags, int access, int shareAccess, int extFileAttributes, int createOptions, ServerMessageBlock andx)


        
                 
                 
                 
                 
                   
        super( andx );
        this.path = name;
        command = SMB_COM_NT_CREATE_ANDX;

        desiredAccess = access;
        desiredAccess |= FILE_READ_DATA | FILE_READ_EA | FILE_READ_ATTRIBUTES;

        // extFileAttributes
        this.extFileAttributes = extFileAttributes;

        // shareAccess
        this.shareAccess = shareAccess;

        // createDisposition
        if(( flags & SmbFile.O_TRUNC ) == SmbFile.O_TRUNC ) {
            // truncate the file
            if(( flags & SmbFile.O_CREAT ) == SmbFile.O_CREAT ) {
                // create it if necessary
                createDisposition = FILE_OVERWRITE_IF;
            } else {
                createDisposition = FILE_OVERWRITE;
            }
        } else {
            // don't truncate the file
            if(( flags & SmbFile.O_CREAT ) == SmbFile.O_CREAT ) {
                // create it if necessary
                if ((flags & SmbFile.O_EXCL ) == SmbFile.O_EXCL ) {
                    // fail if already exists
                    createDisposition = FILE_CREATE;
                } else {
                    createDisposition = FILE_OPEN_IF;
                }
            } else {
                createDisposition = FILE_OPEN;
            }
        }

        if ((createOptions & 0x0001) == 0) {
            this.createOptions = createOptions | 0x0040;
        } else {
            this.createOptions = createOptions;
        }
        impersonationLevel = 0x02; // As seen on NT :~)
        securityFlags = (byte)0x03; // SECURITY_CONTEXT_TRACKING | SECURITY_EFFECTIVE_ONLY
    
Methods Summary
intreadBytesWireFormat(byte[] buffer, int bufferIndex)

        return 0;
    
intreadParameterWordsWireFormat(byte[] buffer, int bufferIndex)

        return 0;
    
public java.lang.StringtoString()

        return new String( "SmbComNTCreateAndX[" +
            super.toString() +
            ",flags=0x" + Hexdump.toHexString( flags0, 2 ) +
            ",rootDirectoryFid=" + rootDirectoryFid +
            ",desiredAccess=0x" + Hexdump.toHexString( desiredAccess, 4 ) +
            ",allocationSize=" + allocationSize +
            ",extFileAttributes=0x" + Hexdump.toHexString( extFileAttributes, 4 ) +
            ",shareAccess=0x" + Hexdump.toHexString( shareAccess, 4 ) +
            ",createDisposition=0x" + Hexdump.toHexString( createDisposition, 4 ) +
            ",createOptions=0x" + Hexdump.toHexString( createOptions, 8 ) +
            ",impersonationLevel=0x" + Hexdump.toHexString( impersonationLevel, 4 ) +
            ",securityFlags=0x" + Hexdump.toHexString( securityFlags, 2 ) +
            ",name=" + path + "]" );
    
intwriteBytesWireFormat(byte[] dst, int dstIndex)

        int n;
        n = writeString( path, dst, dstIndex );
        writeInt2( ( useUnicode ? path.length() * 2 : n ), dst, namelen_index );
        return n;
    
intwriteParameterWordsWireFormat(byte[] dst, int dstIndex)

        int start = dstIndex;

        dst[dstIndex++] = (byte)0x00;
        // name length without counting null termination
        namelen_index = dstIndex;
        dstIndex += 2;
        writeInt4( flags0, dst, dstIndex );
        dstIndex += 4;
        writeInt4( rootDirectoryFid, dst, dstIndex );
        dstIndex += 4;
        writeInt4( desiredAccess, dst, dstIndex );
        dstIndex += 4;
        writeInt8( allocationSize, dst, dstIndex );
        dstIndex += 8;
        writeInt4( extFileAttributes, dst, dstIndex );
        dstIndex += 4;
        writeInt4( shareAccess, dst, dstIndex );
        dstIndex += 4;
        writeInt4( createDisposition, dst, dstIndex );
        dstIndex += 4;
        writeInt4( createOptions, dst, dstIndex );
        dstIndex += 4;
        writeInt4( impersonationLevel, dst, dstIndex );
        dstIndex += 4;
        dst[dstIndex++] = securityFlags;

        return dstIndex - start;