This commit is contained in:
Mario Fetka
2026-05-23 16:15:44 +02:00
parent 1f5cf85229
commit b5891740cf

126
nwtests.c
View File

@@ -868,6 +868,126 @@ static int tests_nwreq87vlmreg(int argc, char *argv[])
}
static int tests_nwreq87vlmconn_one(UI conn_value, UI label_value)
{
uint8 connid = 0;
uint8 dhandle = 0;
uint8 hdr[16];
uint8 path[300];
uint8 repl[0x180];
TEST_NWFRAG16 reqfrags[2];
TEST_NWFRAG16 replfrags[2];
UI path_len;
int rc;
uint32 dw0;
uint32 dw4d;
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);
path_len = tests_build_nwreq87_path_multi(path, dhandle, 0, 0, 1,
"LOGIN.EXE", 0, 0);
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, "TEST NWREQ87VLMCONN value=%u label=%u\n",
conn_value, label_value);
fprintf(stdout, "drive connid=%u dhandle=%u path_len=%u\n",
connid, dhandle, path_len);
fprintf(stdout, "VLM call: AX=0057 BX=0002 CX=%04X DX=0002 p1=0006 p2=0020 p3=0000\n",
conn_value);
tests_dump_bytes("HDR :", hdr, 9);
tests_dump_bytes("PATH:", path, path_len > 48 ? 48 : path_len);
rc = Net_Call_VLM_Raw(0x0057, 2, conn_value, 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);
return(rc);
}
static int tests_nwreq87vlmconn(int argc, char *argv[])
{
UI value;
if (argc < 3) {
fprintf(stdout, "Usage: TESTS NWREQ87VLMCONN value\n");
fprintf(stdout, "Examples:\n");
fprintf(stdout, " TESTS NWREQ87VLMCONN 0\n");
fprintf(stdout, " TESTS NWREQ87VLMCONN 1\n");
fprintf(stdout, " TESTS NWREQ87VLMCONN 2\n");
fprintf(stdout, "Hex is not parsed; use decimal values.\n");
return(1);
}
value = (UI)atoi(argv[2]);
return tests_nwreq87vlmconn_one(value, value);
}
static int tests_nwreq87vlmconnmatrix(void)
{
UI values[10];
int i;
uint8 connid = 0;
uint8 dhandle = 0;
uint8 flags = 0;
int drive;
drive = tests_get_current_drive();
get_drive_info((uint8)drive, &connid, &dhandle, &flags);
/*
* Paged matrix: one screen per value.
* Start with likely connection-reference candidates.
*/
values[0] = 0;
values[1] = 1;
values[2] = 2;
values[3] = 3;
values[4] = (UI)connid;
values[5] = (UI)dhandle;
values[6] = (UI)drive;
values[7] = (UI)(drive + 1);
values[8] = 0x31; /* low byte observed in AH=DC CX=3130 */
values[9] = 0x3130; /* AH=DC returned CX */
fprintf(stdout, "TEST NWREQ87VLMCONNMATRIX paged\n");
fprintf(stdout, "current drive=%c: connid=%u dhandle=%u flags=%02X\n",
'A' + drive, connid, dhandle, flags);
tests_wait_key();
for (i = 0; i < 10; i++) {
tests_nwreq87vlmconn_one(values[i], (UI)i);
if (i != 9)
tests_wait_key();
}
return(0);
}
int func_tests(int argc, char *argv[], int mode)
{
if (argc >= 2) {
@@ -889,6 +1009,12 @@ int func_tests(int argc, char *argv[], int mode)
if (tests_same_arg(argv[1], "NWREQ87VLMCASE"))
return tests_nwreq87vlmcase(argc, argv);
if (tests_same_arg(argv[1], "NWREQ87VLMCONN"))
return tests_nwreq87vlmconn(argc, argv);
if (tests_same_arg(argv[1], "NWREQ87VLMCONNMATRIX"))
return tests_nwreq87vlmconnmatrix();
if (tests_same_arg(argv[1], "NWREQ87VLMREG"))
return tests_nwreq87vlmreg(argc, argv);