1--- jcifs_1.3.12/src/jcifs/smb/SmbFile.java 2+++ jcifs/src/jcifs/smb/SmbFile.java 3@@ -2564,6 +2564,21 @@ 4 attrExpiration = 0; 5 } 6 7+ void setPathInformation( int attrs, long ctime, long atime, long mtime ) throws SmbException { 8+ int f, dir; 9+ 10+ exists(); 11+ dir = attributes & ATTR_DIRECTORY; 12+ 13+ f = open0( O_RDONLY, FILE_WRITE_ATTRIBUTES, 14+ dir, dir != 0 ? 0x0001 : 0x0040 ); 15+ send( new Trans2SetFileInformation( f, attrs | dir, ctime, atime, mtime ), 16+ new Trans2SetFileInformationResponse() ); 17+ close( f, 0L ); 18+ 19+ attrExpiration = 0; 20+ } 21+ 22 /** 23 * Set the create time of the file. The time is specified as milliseconds 24 * from Jan 1, 1970 which is the same as that which is returned by the 25@@ -2581,6 +2596,22 @@ 26 setPathInformation( 0, time, 0L ); 27 } 28 /** 29+ * Set the access time of the file. The time is specified as milliseconds 30+ * from Jan 1, 1970 which is the same as that which is returned by the 31+ * <tt>createTime()</tt> method. 32+ * <p/> 33+ * This method does not apply to workgroups, servers, or shares. 34+ * 35+ * @param time the create time as milliseconds since Jan 1, 1970 36+ */ 37+ public void setAccessTime( long time ) throws SmbException { 38+ if( getUncPath0().length() == 1 ) { 39+ throw new SmbException( "Invalid operation for workgroups, servers, or shares" ); 40+ } 41+ 42+ setPathInformation( 0, 0L, time, 0L ); 43+ } 44+/** 45 * Set the last modified time of the file. The time is specified as milliseconds 46 * from Jan 1, 1970 which is the same as that which is returned by the 47 * <tt>lastModified()</tt>, <tt>getLastModified()</tt>, and <tt>getDate()</tt> methods. 48--- jcifs_1.3.12/src/jcifs/smb/Trans2SetFileInformation.java 49+++ jcifs/src/jcifs/smb/Trans2SetFileInformation.java 50@@ -25,6 +25,7 @@ 51 private int fid; 52 private int attributes; 53 private long createTime, lastWriteTime; 54+ private long accessTime; 55 56 Trans2SetFileInformation( int fid, int attributes, long createTime, long lastWriteTime ) { 57 this.fid = fid; 58@@ -38,6 +39,19 @@ 59 maxSetupCount = (byte)0x00; 60 } 61 62+ Trans2SetFileInformation( int fid, int attributes, long createTime, long accessTime, long lastWriteTime ) { 63+ this.fid = fid; 64+ this.attributes = attributes; 65+ this.accessTime = accessTime; 66+ this.createTime = createTime; 67+ this.lastWriteTime = lastWriteTime; 68+ command = SMB_COM_TRANSACTION2; 69+ subCommand = TRANS2_SET_FILE_INFORMATION; 70+ maxParameterCount = 6; 71+ maxDataCount = 0; 72+ maxSetupCount = (byte)0x00; 73+ } 74+ 75 int writeSetupWireFormat( byte[] dst, int dstIndex ) { 76 dst[dstIndex++] = subCommand; 77 dst[dstIndex++] = (byte)0x00; 78@@ -58,13 +72,22 @@ 79 int writeDataWireFormat( byte[] dst, int dstIndex ) { 80 int start = dstIndex; 81 82+ // create time 83 writeTime( createTime, dst, dstIndex ); dstIndex += 8; 84- writeInt8( 0L, dst, dstIndex ); dstIndex += 8; 85+ 86+ // access time 87+ writeInt8( accessTime, dst, dstIndex ); dstIndex += 8; 88+ 89+ // last write time [modification] 90 writeTime( lastWriteTime, dst, dstIndex ); dstIndex += 8; 91+ 92+ // change time 93 writeInt8( 0L, dst, dstIndex ); dstIndex += 8; 94+ 95 /* Samba 2.2.7 needs ATTR_NORMAL 96 */ 97 writeInt2( 0x80 | attributes, dst, dstIndex ); dstIndex += 2; 98+ 99 /* 6 zeros observed with NT */ 100 writeInt8( 0L, dst, dstIndex ); dstIndex += 6; 101 102