Commit 1c0801eb authored by Colin Granville's avatar Colin Granville Committed by ROOL
Browse files

Option to enable hidden files to be seen in LanManFS

Details:
  Allow name mode to select visibility of hidden files to be switched on or off.
  The default remains off.
  Resources/UK/CmdHelp, cmhg/LanMan_MH, c/LanMan and c/SMB modified. SMB_Delete, SMB_Rename and SMB_GetAttibs
  in c/SMB modified to work with switch.
Admin:
  Tested with ARMX6 connected to Armbian.

Version 2.67. Tagged as 'OmniLanManFS-2_67'
parent 1052e13e
No preview for this file type
......@@ -29,6 +29,13 @@ Prns:Printers
Mnt:Mount
On:on server
User:as user
NMMode:Capitalisation of DOS short file names
NMMode0:Preserved
NMMode1:Lowercase
NMMode2:First caps
NMHid:Hidden files and directories
Exc:Excluded
Inc:Included
D00:EnumShares could not log on to %s
D01:EnumShares call on %s
D02:Can't find master browser or DC for %s
......
/* (2.66)
/* (2.67)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 2.66
#define Module_MajorVersion_CMHG 2.67
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 31 Aug 2020
#define Module_Date_CMHG 19 May 2021
#define Module_MajorVersion "2.66"
#define Module_Version 266
#define Module_MajorVersion "2.67"
#define Module_Version 267
#define Module_MinorVersion ""
#define Module_Date "31 Aug 2020"
#define Module_Date "19 May 2021"
#define Module_ApplicationDate "31-Aug-20"
#define Module_ApplicationDate "19-May-21"
#define Module_ComponentName "OmniLanManFS"
#define Module_FullVersion "2.66"
#define Module_HelpVersion "2.66 (31 Aug 2020)"
#define Module_LibraryVersionInfo "2:66"
#define Module_FullVersion "2.67"
#define Module_HelpVersion "2.67 (19 May 2021)"
#define Module_LibraryVersionInfo "2:67"
......@@ -607,21 +607,97 @@ static _kernel_oserror *Cmd_LMInfo ( const char *args )
static _kernel_oserror *Cmd_LMNameMode ( const char *args )
{
char *argv[1];
int tmp;
int i, mode, hidden, flags = 0;
__packed struct
{
int flags[6];
char type;
int mode;
char spare[3]; /* required for sizeof(a) to work with readargs */
} parsed;
_kernel_oserror *e;
e = _swix(OS_ReadArgs, _INR(0,3),
"/e,preservecase/s,lowercase/s,firstcaps/s,includehidden/s,excludehidden/s",
args, &parsed, sizeof(parsed));
if (e != NULL)
{
/* Convert buffer overflow to bad parameters */
return e->errnum == ErrorNumber_BuffOverflow ? MsgError(EBADPARAM) : e;
}
if ( GetArgs( args, argv, 1 ) < 1 ||
sscanf( argv[0], "%d", &tmp) != 1 ||
tmp < 0 ||
#ifdef TRACE
0
#else
tmp > 2
#endif
)
return MsgError (EBADPARAM);
for (i = 0; i < (sizeof(parsed.flags) / sizeof(parsed.flags[0])); i++)
{
if (parsed.flags[i]) flags |= (1 << i);
}
if (flags == 0)
{
const char *token;
/* No arguments given, show the current state */
switch (LM_Vars.namemode & NM_MODE)
{
default: /* Preserve case */
token = "NMMode0";
break;
case NM_LOWERCASE: token = "NMMode1";
break;
case NM_FIRSTCAPS: token = "NMMode2";
break;
}
printf("%s: ", MsgLookup("NMMode"));
printf("%s\n", MsgLookup(token));
printf("%s: ", MsgLookup("NMHid"));
printf("%s\n", MsgLookup((LM_Vars.namemode & NM_HIDDEN) ? "Inc" : "Exc"));
return NULL;
}
mode = hidden = -1;
switch (flags & 0xf)
{
case 1: /* Numeric mode */
if (parsed.type != 0 /* Integer */ || parsed.mode > 2 || parsed.mode < 0)
{
return MsgError(EBADPARAM);
}
mode = parsed.mode;
break;
case 2: /* PreserveCase */
case 4: /* Lowercase */
case 8: /* FirstCaps */
mode = (flags >> 2) & NM_MODE;
break;
}
switch (flags & 0x30)
{
case 0x10: /* IncludeHidden */
hidden = NM_HIDDEN;
break;
case 0x20: /* ExcludeHidden */
hidden = 0;
break;
case 0x30: return MsgError(EBADPARAM);
}
if (mode == -1 && hidden == -1)
return MsgError(EBADPARAM);
if (mode != -1)
{
LM_Vars.namemode &= ~NM_MODE;
LM_Vars.namemode |= mode;
}
if (hidden != -1)
{
LM_Vars.namemode &= ~NM_HIDDEN;
LM_Vars.namemode |= hidden;
}
LM_Vars.namemode = tmp;
return NULL;
}
......
......@@ -1747,7 +1747,14 @@ err_t SMB_Delete ( char *path )
if ( pB == NULL )
return EOUTOFMEM;
SMB_TxWords[0] = ATTR_NORM;
if (LM_Vars.namemode & NM_HIDDEN)
{
SMB_TxWords[0] = ATTR_NORM | ATTR_SYS | ATTR_HID;
}
else
{
SMB_TxWords[0] = ATTR_NORM;
}
return Do_SMB ( hS, SMBunlink, 1, pB, NULL );
}
......@@ -1778,7 +1785,14 @@ err_t SMB_Rename ( char *oldpath, char *newpath )
if ( pB == NULL )
return EOUTOFMEM;
SMB_TxWords[0] = ATTR_NORM | ATTR_DIR; /* Permit both file and dir renaming */
if (LM_Vars.namemode & NM_HIDDEN)
{
SMB_TxWords[0] = ATTR_DIR | ATTR_SYS | ATTR_HID;
}
else
{
SMB_TxWords[0] = ATTR_NORM | ATTR_DIR; /* Permit both file and dir renaming */
}
return Do_SMB ( hS, SMBmv, 1, pB, NULL );
}
......@@ -1834,7 +1848,7 @@ static err_t SMB_GetAttribsX2 (hSHARE hS, char *filename, DOS_ATTRIBS *pAttr )
fnbuffer[3] = '\0';
Transact_init(&tp, 6 * 2); /* will accept 6 WORD return params */
Transact_addsetupword(&tp, TRANSACT2_FINDFIRST);
if (LM_Vars.namemode & NM_INTERNAL)
if (LM_Vars.namemode & NM_HIDDEN)
{ /* findfirst_Attribute */
Transact_addword(&tp, ATTR_DIR | ATTR_SYS | ATTR_HID);
}
......@@ -1974,7 +1988,14 @@ err_t SMB_GetAttribs ( char *filename, DOS_ATTRIBS *pAttr )
return EOUTOFMEM;
SMB_TxWords[0] = 1; /* Count of entries to return */
SMB_TxWords[1] = ATTR_DIR; /* Return files & directories info */
if (LM_Vars.namemode & NM_HIDDEN)
{
SMB_TxWords[1] = ATTR_DIR | ATTR_SYS | ATTR_HID;
}
else
{
SMB_TxWords[1] = ATTR_DIR; /* Return files & directories info */
}
res = Do_SMB ( hS, SMBsearch, 2, pB, &pBres );
......@@ -2193,7 +2214,7 @@ static err_t SMB_ReadDirEntriesX2 ( hSHARE hS, char *path, int count,
*/
Transact_init(&con->tp, 6 * 2); /* will accept 6 WORD return params */
Transact_addsetupword(&con->tp, TRANSACT2_FINDFIRST);
if (LM_Vars.namemode & NM_INTERNAL) { /* findfirst_Attribute */
if (LM_Vars.namemode & NM_HIDDEN) { /* findfirst_Attribute */
Transact_addword(&con->tp, ATTR_DIR | ATTR_SYS | ATTR_HID);
}
else {
......@@ -3361,7 +3382,7 @@ err_t SMBFind_EnumDir(SMBFind_t *fnd, int dir_offset, const char *ro_path, int c
Transact_init(&tp, 6 * 2); /* sizeof response Trans2_Parameters - 6 WORDs */
Transact_addsetupword(&tp, TRANSACT2_FINDFIRST);
/* Trans2_Parameters */
if (LM_Vars.namemode & NM_INTERNAL)
if (LM_Vars.namemode & NM_HIDDEN)
{
Transact_addword(&tp, ATTR_DIR | ATTR_SYS | ATTR_HID); /* SearchAttributes */
}
......
......@@ -79,10 +79,9 @@ command-keyword-table: LM_Command
help-text: "*LMInfo displays debugging information\n",
invalid-syntax: "Syntax:\t*LMInfo", ),
LMNameMode(min-args:1, max-args:1, add-syntax:, fs-command:,
help-text: "*LMNameMode sets the way LanManFS capitalises names on DOS shares, "
"it does not affect long filename shares\n",
invalid-syntax: "Syntax:\t*LMNameMode 0 | 1 | 2", ),
LMNameMode(min-args:0, max-args:2, add-syntax:, fs-command:,
help-text: "*LMNameMode sets the capitalisation of DOS short names on DOS shares and whether hidden files are shown.\n"
invalid-syntax: "Syntax:\t*LMNameMode [-PreserveCase | -Lowercase | -FirstCaps] [-IncludeHidden | -ExcludeHidden]", ),
LMLogoff(min-args:0, max-args:0, add-syntax:, fs-command:,
help-text: "*LMLogoff clears the workgroup and default user settings "
......@@ -146,7 +145,7 @@ command-keyword-table: LM_Command
help-text: "HINFO",
invalid-syntax: "SINFO", ),
LMNameMode(min-args:1, max-args:1, international:, fs-command:,
LMNameMode(min-args:0, max-args:2, international:, fs-command:,
help-text: "HNMOD",
invalid-syntax: "SNMOD", ),
......
......@@ -49,7 +49,8 @@ extern void Xlt_NameDOStoRO ( char *riscos_dst, char *dos_src );
#define NM_PRESERVED 0
#define NM_LOWERCASE 1
#define NM_FIRSTCAPS 2
#define NM_INTERNAL 4 /* Can't be selected at the CLI */
#define NM_MODE (NM_LOWERCASE | NM_FIRSTCAPS)
#define NM_HIDDEN 4
extern err_t Xlt_ExpandSearchEntry ( BYTE *entry,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment