This commit is contained in:
Mario Fetka
2026-05-23 16:31:37 +02:00
parent b5891740cf
commit 0d466ce30a

143
nwtests.c
View File

@@ -988,6 +988,146 @@ static int tests_nwreq87vlmconnmatrix(void)
}
static UI tests_build_novell_handle_path(uint8 *buf, uint8 dhandle,
uint16 dirbase, uint8 style,
int count,
char *c1, char *c2, char *c3)
{
uint8 *p;
int l;
UI used;
/*
* DeveloperNet fillhan.o:
* memset(pathStruct, 0, 0x133)
* if handle != 0:
* byte[5] = 0
* word[1] = handle
* word[3] = 0
* else:
* byte[5] = 0xff
*
* _NWGETCOMPATHSTRUCTLENGTH reads component count at offset 6 and returns
* 7 + sum(1 + componentLen)
*
* ncpdos16 87s6.c sends frag2 from struct start with length stored at +13c.
*/
memset(buf, 0, 0x140);
if (dhandle) {
tests_put_word_lh(buf + 1, (uint16)dhandle);
tests_put_word_lh(buf + 3, dirbase);
buf[5] = style;
} else {
buf[5] = 0xff;
}
p = buf + 6;
*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;
}
used = (UI)(p - buf);
tests_put_word_lh(buf + 0x13c, used);
return used;
}
static int tests_nwreq87vlmfull_one(char *label, uint8 connid,
uint8 *hdr, uint8 *path_struct)
{
uint8 repl[0x180];
TEST_NWFRAG16 reqfrags[2];
TEST_NWFRAG16 replfrags[2];
UI path_len;
int rc;
uint32 dw0;
uint32 dw4d;
path_len = (UI)(path_struct[0x13c] | ((UI)path_struct[0x13d] << 8));
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_struct, path_len);
tests_set_frag(&replfrags[0], repl, 0x4d);
tests_set_frag(&replfrags[1], repl + 0x4d, 0x100);
fprintf(stdout, "\nCASE %s\n", label);
fprintf(stdout, "path_len=%u\n", path_len);
tests_dump_bytes("PATH:", path_struct, 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);
dw0 = tests_get_dword_lh(repl);
dw4d = tests_get_dword_lh(repl + 0x4d);
fprintf(stdout, "DW0=%08lX DW4D=%08lX\n", dw0, dw4d);
tests_wait_key();
return rc;
}
static int tests_nwreq87vlmfull(void)
{
uint8 connid = 0;
uint8 dhandle = 0;
uint8 flags = 0;
int drive;
uint8 hdr[16];
uint8 path[0x140];
drive = tests_get_current_drive();
if (get_drive_info((uint8)drive, &connid, &dhandle, &flags)) {
fprintf(stdout, "get_drive_info failed\n");
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 NWREQ87VLMFULL Novell handle/path struct\n");
fprintf(stdout, "drive=%c: connid=%u dhandle=%u flags=%02X\n",
'A' + drive, connid, dhandle, flags);
tests_dump_bytes("HDR:", hdr, 9);
tests_wait_key();
tests_build_novell_handle_path(path, dhandle, 0, 0, 1,
"LOGIN.EXE", 0, 0);
tests_nwreq87vlmfull_one("1 dhandle LOGIN.EXE", connid, hdr, path);
tests_build_novell_handle_path(path, dhandle, 0, 0, 2,
"PUBLIC", "LOGIN.EXE", 0);
tests_nwreq87vlmfull_one("2 dhandle PUBLIC/LOGIN.EXE", connid, hdr, path);
tests_build_novell_handle_path(path, 0, 0, 0, 2,
"PUBLIC", "LOGIN.EXE", 0);
tests_nwreq87vlmfull_one("3 handle0 PUBLIC/LOGIN.EXE", connid, hdr, path);
return(0);
}
int func_tests(int argc, char *argv[], int mode)
{
if (argc >= 2) {
@@ -1015,6 +1155,9 @@ int func_tests(int argc, char *argv[], int mode)
if (tests_same_arg(argv[1], "NWREQ87VLMCONNMATRIX"))
return tests_nwreq87vlmconnmatrix();
if (tests_same_arg(argv[1], "NWREQ87VLMFULL"))
return tests_nwreq87vlmfull();
if (tests_same_arg(argv[1], "NWREQ87VLMREG"))
return tests_nwreq87vlmreg(argc, argv);