This commit is contained in:
Mario Fetka
2026-05-23 15:50:05 +02:00
parent f6b017391b
commit 52170c1092

131
nwtests.c
View File

@@ -510,6 +510,134 @@ static int tests_nwreq87vlm(int argc, char *argv[])
}
static UI tests_build_nwreq87_path_multi(uint8 *buf, uint8 dhandle,
UI dirbase, uint8 style,
int count,
char *c1, char *c2, char *c3)
{
uint8 *p;
int l;
memset(buf, 0, 300);
p = buf;
*p++ = dhandle;
tests_put_dword_lh(p, (uint32)dirbase); p += 4;
*p++ = style;
*p++ = (uint8)count;
if (count > 0 && c1) {
l = strlen(c1); if (l > 255) l = 255;
*p++ = (uint8)l; memcpy(p, c1, l); p += l;
}
if (count > 1 && c2) {
l = strlen(c2); if (l > 255) l = 255;
*p++ = (uint8)l; memcpy(p, c2, l); p += l;
}
if (count > 2 && c3) {
l = strlen(c3); if (l > 255) l = 255;
*p++ = (uint8)l; memcpy(p, c3, l); p += l;
}
return (UI)(p - buf);
}
static int tests_nwreq87vlm_one(char *label, uint8 connid,
uint8 *hdr, uint8 *path, UI path_len)
{
uint8 repl[0x180];
TEST_NWFRAG16 reqfrags[2];
TEST_NWFRAG16 replfrags[2];
int rc;
uint32 a0;
uint32 a4d;
memset(repl, 0, sizeof(repl));
memset(reqfrags, 0, sizeof(reqfrags));
memset(replfrags, 0, sizeof(replfrags));
tests_set_frag(&reqfrags[0], hdr, 9);
tests_set_frag(&reqfrags[1], path, path_len);
tests_set_frag(&replfrags[0], repl, 0x4d);
tests_set_frag(&replfrags[1], repl + 0x4d, 0x100);
fprintf(stdout, "\nCASE %s\n", label);
tests_dump_bytes("PATH:", path, path_len > 64 ? 64 : path_len);
rc = Net_Call_VLM_Raw(0x0057, 2, (UI)connid, 2,
reqfrags, replfrags,
6, 0x20, 0);
fprintf(stdout, "RC=%04X\n", rc);
tests_dump_bytes("REPL0:", repl, 32);
tests_dump_bytes("REPL4D:", repl + 0x4d, 32);
a0 = tests_get_dword_lh(repl);
a4d = tests_get_dword_lh(repl + 0x4d);
fprintf(stdout, "DW0=%08lX DW4D=%08lX\n", a0, a4d);
return rc;
}
static int tests_nwreq87vlmmatrix(int argc, char *argv[])
{
char *name = "LOGIN.EXE";
uint8 connid = 0;
uint8 dhandle = 0;
uint8 hdr[16];
uint8 path[300];
UI len;
(void)argc;
(void)argv;
if (tests_current_conn_dhandle(&connid, &dhandle))
return(1);
memset(hdr, 0, sizeof(hdr));
hdr[0] = 6;
hdr[1] = 0;
hdr[2] = 0;
tests_put_word_lh(hdr + 3, 0x0006);
tests_put_dword_lh(hdr + 5, 0x00000004UL);
fprintf(stdout, "TEST NWREQ87VLMMATRIX NCP87/S6\n");
fprintf(stdout, "connid=%u dhandle=%u file=%s\n", connid, dhandle, name);
tests_dump_bytes("HDR:", hdr, 9);
/*
* We know the VLM transport is reached. RC=81 now likely means our
* packed handle/path is wrong for NCP87. Try the common handle/path
* variants:
*
* current mapped handle + file
* current mapped handle + PUBLIC/file
* root handle 0 + PUBLIC/file
* style 1 variants in case dirstyle differs
*/
len = tests_build_nwreq87_path_multi(path, dhandle, 0, 0, 1,
"LOGIN.EXE", 0, 0);
tests_nwreq87vlm_one("h=dhandle style=0 LOGIN.EXE", connid, hdr, path, len);
len = tests_build_nwreq87_path_multi(path, dhandle, 0, 0, 2,
"PUBLIC", "LOGIN.EXE", 0);
tests_nwreq87vlm_one("h=dhandle style=0 PUBLIC/LOGIN.EXE", connid, hdr, path, len);
len = tests_build_nwreq87_path_multi(path, 0, 0, 0, 2,
"PUBLIC", "LOGIN.EXE", 0);
tests_nwreq87vlm_one("h=0 style=0 PUBLIC/LOGIN.EXE", connid, hdr, path, len);
len = tests_build_nwreq87_path_multi(path, dhandle, 0, 1, 1,
"LOGIN.EXE", 0, 0);
tests_nwreq87vlm_one("h=dhandle style=1 LOGIN.EXE", connid, hdr, path, len);
len = tests_build_nwreq87_path_multi(path, 0, 0, 1, 2,
"PUBLIC", "LOGIN.EXE", 0);
tests_nwreq87vlm_one("h=0 style=1 PUBLIC/LOGIN.EXE", connid, hdr, path, len);
return(0);
}
int func_tests(int argc, char *argv[], int mode)
{
if (argc >= 2) {
@@ -525,6 +653,9 @@ int func_tests(int argc, char *argv[], int mode)
if (tests_same_arg(argv[1], "NWREQ87VLM"))
return tests_nwreq87vlm(argc, argv);
if (tests_same_arg(argv[1], "NWREQ87VLMMATRIX"))
return tests_nwreq87vlmmatrix(argc, argv);
if (tests_same_arg(argv[1], "NCPF2"))
return tests_ncpf2(argc, argv);