Skip to content

Commit b7c580d

Browse files
committed
mount enumeration (#141)
1 parent ee5da11 commit b7c580d

File tree

4 files changed

+67
-17
lines changed

4 files changed

+67
-17
lines changed

mcwin32/ChangeLog.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
Fri May 15 11:47:09 2025 adamy
1+
Thu May 22 14:03:24 2025 adamy
22

33
* build-235
44

5-
o network drive interaction (#141)
5+
o improve command-line locale/utf-8 support (#147)
6+
o screen buffer save/restore (#143)
7+
o network drive enumeration (#141)
68

79
Wed May 14 10:50:13 2025 adamy
810

mcwin32/libw32/termemu_vio.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3004,7 +3004,8 @@ vio_restore_lines(int top, int bottom, int to)
30043004

30053005
assert(to >= -1);
30063006

3007-
if (NULL == state->image) return; // uninitialised
3007+
if (NULL == state || NULL == state->image) // uninitialised
3008+
return;
30083009

30093010
// Size arena
30103011
vio_size(console, &rows, &cols);
@@ -3067,7 +3068,8 @@ vio_restore(void)
30673068
vio.chandle : GetStdHandle(STD_OUTPUT_HANDLE));
30683069
int rows = 0, cols = 0;
30693070

3070-
if (NULL == vio_state.alt.image) return; // uninitialised
3071+
if (NULL == vio_state.alt.image) // uninitialised
3072+
return;
30713073

30723074
// Size arena
30733075
vio_size(console, &rows, &cols);

mcwin32/src/volinfo/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
# volinfo - volume information
3+
4+
A test framework which simulates the existing drive mapping emulation logic, analyses access times, and reports the corresponding delays.
5+
6+
Facilitates the diagnosis and testing of the mounted system file interface, illuminating any access issues/bottle necks.
7+
8+
## Usage
9+
10+
```
11+
volinfo [options] [attributes] <operation>
12+
13+
Query disk information using on the following operations:
14+
15+
Operations:
16+
volumes - Iterate by volume enumeration.
17+
network - Iterate by network enumeration.
18+
drives - Iterate published drive letters.
19+
all - All available methods.
20+
21+
Attributes:
22+
--volumeinfo Volume information.
23+
--drivetype Drive type.
24+
--attributes Attributes.
25+
--freespace Free space.
26+
--statfs statfs, all attributes.
27+
28+
Options:
29+
--time Access timestamps.
30+
--verbose Additional info.
31+
--netconnected Network status (default: connected).
32+
or --netremembered.
33+
--help
34+
```

mcwin32/src/volinfo/volinfo.c

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ static void OutputW(const wchar_t *, ...);
4949

5050
static int otimestamp = 0;
5151
static int overbose = 0;
52+
static int onetconnected = 1;
53+
5254
static int ovolumeinfo = 0;
5355
static int odrivetype = 0;
5456
static int oattributes = 0;
@@ -78,6 +80,11 @@ main(int argc, char *argv[])
7880
} else if ((val = IsOption(option, "--verbose")) != NULL) {
7981
overbose = 1;
8082

83+
} else if ((val = IsOption(option, "--netconnected")) != NULL) {
84+
onetconnected = 1;
85+
} else if ((val = IsOption(option, "--netremembered")) != NULL) {
86+
onetconnected = 0;
87+
8188
} else if ((val = IsOption(option, "--volumeinfo")) != NULL) {
8289
ovolumeinfo = 1;
8390
} else if ((val = IsOption(option, "--drivetype")) != NULL) {
@@ -285,14 +292,18 @@ static void NetworkDisplayStruct(unsigned i, LPNETRESOURCEW lpnrLocal);
285292
static BOOL WINAPI
286293
EnumNetworkFunc(LPNETRESOURCEW lpnr)
287294
{
295+
const DWORD dwScope = (onetconnected ? RESOURCE_CONNECTED : RESOURCE_REMEMBERED);
296+
// CONNECTED - Open connections.
297+
// REMEMBERED - PERSISTED, aka are connected at log-on.
298+
288299
DWORD cbBuffer = 16384; // buffer size
289300
DWORD dwResult, dwResultEnum;
290301
DWORD cEntries = (DWORD)-1; // enumerate all possible entries
291302
LPNETRESOURCEW lpnrLocal = NULL; // pointer to enumerated structures
292303
HANDLE hEnum = NULL;
293304

294305
// Enumerate all currently connected resources.
295-
dwResult = WNetOpenEnumW(RESOURCE_CONNECTED, RESOURCETYPE_DISK, 0, lpnr, &hEnum);
306+
dwResult = WNetOpenEnumW(dwScope, RESOURCETYPE_DISK, 0, lpnr, &hEnum);
296307
if (dwResult != NO_ERROR) {
297308
OutputA("WnetOpenEnum: failure %u\n", (unsigned)dwResult);
298309
return FALSE;
@@ -679,21 +690,23 @@ Usage(void)
679690
" Query disk information using on the following operations:\n" \
680691
"\n" \
681692
"Operations:\n" \
682-
" volumes - iterate by volume enumeration.\n" \
683-
" network - iterate by network enumeration.\n" \
684-
" drives - iterate published drive letters.\n" \
685-
" all - all available methods.\n" \
693+
" volumes - Iterate by volume enumeration.\n" \
694+
" network - Iterate by network enumeration.\n" \
695+
" drives - Iterate published drive letters.\n" \
696+
" all - All available methods.\n" \
686697
"\n" \
687698
"Attributes:\n" \
688-
" --volumeinfo Volume information.\n" \
689-
" --drivetype Drive type.\n" \
690-
" --attributes Attributes.\n" \
691-
" --freespace Free space.\n" \
692-
" --statfs statfs, all attributes.\n" \
699+
" --volumeinfo Volume information.\n" \
700+
" --drivetype Drive type.\n" \
701+
" --attributes Attributes.\n" \
702+
" --freespace Free space.\n" \
703+
" --statfs statfs, all attributes.\n" \
693704
"\n" \
694705
"Options:\n" \
695-
" --time Access timestamps.\n" \
696-
" --verbose Additional info.\n" \
706+
" --time Access timestamps.\n" \
707+
" --verbose Additional info.\n" \
708+
" --netconnected Network status (default: connected).\n" \
709+
" or --netremembered.\n" \
697710
" --help\n" \
698711
"\n");
699712
}
@@ -733,4 +746,3 @@ OutputW(const wchar_t *fmt, ...)
733746
}
734747

735748
//end
736-

0 commit comments

Comments
 (0)