index c2889a5..f391015 100644 --- a/c/SMB +++ b/c/SMB @@ -303,6 +303,7 @@ struct ActiveShare int FH_base; /* Base number for file handles */ char drvletter; /* Letter for identifying 'drive' */ char sharename[SHARENAME_LEN]; /* upper case */ + int serverTimeZone; /* utc == SMB_DATETIME + serverTimeZone */ }; @@ -328,6 +329,8 @@ static struct ActiveShare SMB_Shares[MAX_SHARES]; BYTE SMB_WorkBuf[SMBWORKBUF_SIZE]; +static int current_server_timezone; + /* SMB routines ======================================================== */ static int DOS_Errs[] = @@ -364,6 +367,12 @@ static int SMB_Errs[] = /* --------------------------- */ +int SMB_get_current_server_timezone(void) +{ + return current_server_timezone; +} + + static err_t Err_Translate ( int class, int code ) { int *p1; @@ -884,6 +893,9 @@ static err_t SMB_Negotiate( hSHARE hS ) } hS->hServer->bloblen = SMB_RxWords[16] >> 8; hS->hServer->Sesskey = (SMB_RxWords[7] >> 8) | (SMB_RxWords[8] << 8) | (SMB_RxWords[9] << 24); + hS->serverTimeZone = (short)((SMB_RxWords[15] >> 8) | (SMB_RxWords[16] << 8)); + hS->serverTimeZone *= 60; /* Convert to seconds */ + current_server_timezone = hS->serverTimeZone; } else { hS->hServer->maxTxBufferSize = SMB_RxWords[2]; @@ -1390,7 +1402,7 @@ static hSHARE GetShare ( const char *filename, err_t *pRes ) return NULL; } } - + current_server_timezone = hS->serverTimeZone; *pRes = OK; return hS; } @@ -1445,7 +1457,10 @@ static hSHARE GetShareFromFH ( uint FH, err_t *pRes ) hSHARE hS=&SMB_Shares[FH]; if ( (hS->flags & (ALLOCATED|CONNECTED)) == (ALLOCATED|CONNECTED) ) + { + current_server_timezone = hS->serverTimeZone; return hS; + } } *pRes = EFILEHANDLE; @@ -2528,8 +2543,9 @@ err_t SMB_Create ( char *filename, DOS_ATTRIBS *pInAttr, colin@castor:~/gitprojects/OmniLanManFS$ git diff diff --git a/c/SMB b/c/SMB index c2889a5..cba131c 100644 --- a/c/SMB +++ b/c/SMB @@ -303,6 +303,7 @@ struct ActiveShare int FH_base; /* Base number for file handles */ char drvletter; /* Letter for identifying 'drive' */ char sharename[SHARENAME_LEN]; /* upper case */ + int serverTimeZone; /* utc == SMB_DATETIME + serverTimeZone */ }; @@ -328,6 +329,8 @@ static struct ActiveShare SMB_Shares[MAX_SHARES]; BYTE SMB_WorkBuf[SMBWORKBUF_SIZE]; +static int current_server_timezone; + /* SMB routines ======================================================== */ static int DOS_Errs[] = @@ -364,6 +367,12 @@ static int SMB_Errs[] = /* --------------------------- */ +int SMB_get_current_server_timezone(void) +{ + return current_server_timezone; +} + + static err_t Err_Translate ( int class, int code ) { int *p1; @@ -884,6 +893,9 @@ static err_t SMB_Negotiate( hSHARE hS ) } hS->hServer->bloblen = SMB_RxWords[16] >> 8; hS->hServer->Sesskey = (SMB_RxWords[7] >> 8) | (SMB_RxWords[8] << 8) | (SMB_RxWords[9] << 24); + hS->serverTimeZone = (short)((SMB_RxWords[15] >> 8) | (SMB_RxWords[16] << 8)); + hS->serverTimeZone *= 60; /* Convert to seconds */ + current_server_timezone = hS->serverTimeZone; } else { hS->hServer->maxTxBufferSize = SMB_RxWords[2]; @@ -1390,7 +1402,7 @@ static hSHARE GetShare ( const char *filename, err_t *pRes ) return NULL; } } - + current_server_timezone = hS->serverTimeZone; *pRes = OK; return hS; } @@ -1445,7 +1457,10 @@ static hSHARE GetShareFromFH ( uint FH, err_t *pRes ) hSHARE hS=&SMB_Shares[FH]; if ( (hS->flags & (ALLOCATED|CONNECTED)) == (ALLOCATED|CONNECTED) ) + { + current_server_timezone = hS->serverTimeZone; return hS; + } } *pRes = EFILEHANDLE; diff --git a/c/Xlate b/c/Xlate index 72192e0..a707c84 100644 --- a/c/Xlate +++ b/c/Xlate @@ -44,6 +44,8 @@ #define FileString_DeadFile "xxx" #define FileString_UntypedFile "lxa" +int SMB_get_current_server_timezone(void); + /* Magic value used to indicate an incomplete file - used by the Filer, * for example, when writing a new file */ @@ -230,8 +232,9 @@ void Xlt_CnvDOStoRO ( DOS_ATTRIBS *pDA, RISCOS_ATTRIBS *pRA, int flags ) if ( flags & CNV_DATETIME ) { - thi = 0x336E99 + (pDA->utime >> 16) * 100; - tlo = 0x6A00 + (pDA->utime & 0xFFFF) * 100; + uint tm = pDA->utime + SMB_get_current_server_timezone(); + thi = 0x336E99 + (tm >> 16) * 100; + tlo = 0x6A00 + (tm & 0xFFFF) * 100; /* Total = (thi << 16)+tlo; */ @@ -287,7 +290,7 @@ void Xlt_CnvROtoDOS ( RISCOS_ATTRIBS *pRA, DOS_ATTRIBS *pDA, int flags ) res = x/100; x = ((x - res*100) << 8) + (pRA->execaddr & 0xFF); res = (res << 8) + (x / 100); - pDA->utime = res; + pDA->utime = res - SMB_get_current_server_timezone(); } }