tests
This commit is contained in:
277
nwtests.c
277
nwtests.c
@@ -1259,157 +1259,150 @@ static int tests_c32callver2(void)
|
||||
}
|
||||
|
||||
|
||||
static void tests_set_reg_word(uint8 *r, int off, UI val)
|
||||
static int tests_c32mapflat(void)
|
||||
{
|
||||
tests_put_word_lh(r + off, (uint16)val);
|
||||
}
|
||||
uint8 out[32];
|
||||
char sample[32];
|
||||
uint16 load_ax, esi_off, esi_seg;
|
||||
uint16 map_lo, map_hi;
|
||||
uint16 unl_ax, unl_dx;
|
||||
|
||||
static UI tests_get_reg_word(uint8 *r, int off)
|
||||
{
|
||||
return (UI)(r[off] | ((UI)r[off + 1] << 8));
|
||||
}
|
||||
strcpy(sample, "C32MAPFLAT");
|
||||
memset(out, 0, sizeof(out));
|
||||
|
||||
static void tests_dump_vlm_regs(char *title, uint8 *r)
|
||||
{
|
||||
fprintf(stdout, "%s SI=%04X DS=%04X DI=%04X ES=%04X AX=%04X BX=%04X CX=%04X DX=%04X\n",
|
||||
title,
|
||||
tests_get_reg_word(r, 0),
|
||||
tests_get_reg_word(r, 2),
|
||||
tests_get_reg_word(r, 4),
|
||||
tests_get_reg_word(r, 6),
|
||||
tests_get_reg_word(r, 8),
|
||||
tests_get_reg_word(r, 10),
|
||||
tests_get_reg_word(r, 12),
|
||||
tests_get_reg_word(r, 14));
|
||||
}
|
||||
fprintf(stdout, "TEST C32MAPFLAT\n");
|
||||
fprintf(stdout, "Probe d32wrap __MapLockFlat/__UnlockFlat via NIOS resolver\n");
|
||||
fprintf(stdout, "sample ptr=%04X:%04X len=%u text=%s\n",
|
||||
FP_SEG(sample), FP_OFF(sample), (UI)strlen(sample) + 1, sample);
|
||||
|
||||
static int tests_c32mapconn(void)
|
||||
{
|
||||
int drive;
|
||||
uint8 connid = 0;
|
||||
uint8 dhandle = 0;
|
||||
uint8 flags = 0;
|
||||
uint8 regs[16];
|
||||
uint8 reply[128];
|
||||
int rc;
|
||||
C32_MapLock_Probe(sample, (UI)strlen(sample) + 1, out);
|
||||
|
||||
drive = tests_get_current_drive();
|
||||
if (get_drive_info((uint8)drive, &connid, &dhandle, &flags)) {
|
||||
fprintf(stdout, "get_drive_info failed\n");
|
||||
return(1);
|
||||
}
|
||||
load_ax = tests_get_word_lh(out + 0);
|
||||
esi_off = tests_get_word_lh(out + 2);
|
||||
esi_seg = tests_get_word_lh(out + 4);
|
||||
map_lo = tests_get_word_lh(out + 6);
|
||||
map_hi = tests_get_word_lh(out + 8);
|
||||
unl_ax = tests_get_word_lh(out + 10);
|
||||
unl_dx = tests_get_word_lh(out + 12);
|
||||
|
||||
memset(regs, 0, sizeof(regs));
|
||||
memset(reply, 0, sizeof(reply));
|
||||
fprintf(stdout, "Load AX=%04X Resolver=%04X:%04X\n",
|
||||
load_ax, esi_seg, esi_off);
|
||||
fprintf(stdout, "MapLock returned flat=%04X:%04X\n", map_hi, map_lo);
|
||||
fprintf(stdout, "Unlock returned DX:AX=%04X:%04X\n", unl_dx, unl_ax);
|
||||
tests_dump_bytes("RAW:", out, 14);
|
||||
|
||||
/*
|
||||
* First half of DeveloperNet __C32MapConn16To32:
|
||||
*
|
||||
* reg.CX = conn16
|
||||
* reg.ES:DI = reply buffer
|
||||
* NWCVLMREQ(flags=2, regblk, p1=0Dh, p2=10h, p3=0)
|
||||
*
|
||||
* The reply buffer should contain the connection/server reference string
|
||||
* that w95mconn.o later passes to NWCSCANCONNINFO.
|
||||
*/
|
||||
tests_set_reg_word(regs, 4, FP_OFF(reply)); /* DI */
|
||||
tests_set_reg_word(regs, 6, FP_SEG(reply)); /* ES */
|
||||
tests_set_reg_word(regs, 12, connid); /* CX */
|
||||
if (load_ax == 0 && (map_lo || map_hi))
|
||||
fprintf(stdout, "\nMapLockFlat appears to work.\n");
|
||||
else
|
||||
fprintf(stdout, "\nMapLockFlat did not return a flat pointer.\n");
|
||||
|
||||
fprintf(stdout, "TEST C32MAPCONN step1, __C32MapConn16To32 VLM probe\n");
|
||||
fprintf(stdout, "drive=%c: connid=%u dhandle=%u flags=%02X\n",
|
||||
'A' + drive, connid, dhandle, flags);
|
||||
tests_dump_vlm_regs("REG in :", regs);
|
||||
fprintf(stdout, "Call NWCVLMREQ flags=2 p1=000D p2=0010 p3=0000\n");
|
||||
|
||||
rc = Net_Call_NWCVLMREQ(2, regs, 0x000D, 0x0010, 0);
|
||||
|
||||
fprintf(stdout, "NWCVLMREQ rc=%04X\n", rc);
|
||||
tests_dump_vlm_regs("REG out:", regs);
|
||||
tests_dump_bytes("REPLY:", reply, 64);
|
||||
fprintf(stdout, "REPLY text: %s\n", reply);
|
||||
|
||||
fprintf(stdout, "\nIf REPLY contains a server/conn string, next step is NWCSCANCONNINFO.\n");
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static int tests_c32mapconn_value(UI conn16, UI label)
|
||||
static int tests_nwreq87c32raw_one(UI connLo, UI connHi, UI label)
|
||||
{
|
||||
uint8 regs[16];
|
||||
uint8 reply[128];
|
||||
int rc;
|
||||
|
||||
memset(regs, 0, sizeof(regs));
|
||||
memset(reply, 0, sizeof(reply));
|
||||
|
||||
tests_set_reg_word(regs, 4, FP_OFF(reply)); /* DI */
|
||||
tests_set_reg_word(regs, 6, FP_SEG(reply)); /* ES */
|
||||
tests_set_reg_word(regs, 12, conn16); /* CX */
|
||||
|
||||
fprintf(stdout, "\nC32MAPCONN value=%u label=%u\n", conn16, label);
|
||||
tests_dump_vlm_regs("REG in :", regs);
|
||||
fprintf(stdout, "Call NWCVLMREQ flags=2 p1=000D p2=0010 p3=0000\n");
|
||||
|
||||
rc = Net_Call_NWCVLMREQ(2, regs, 0x000D, 0x0010, 0);
|
||||
|
||||
fprintf(stdout, "NWCVLMREQ rc=%04X\n", rc);
|
||||
tests_dump_vlm_regs("REG out:", regs);
|
||||
tests_dump_bytes("REPLY:", reply, 64);
|
||||
fprintf(stdout, "REPLY text: %s\n", reply);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int tests_c32mapconnone(int argc, char *argv[])
|
||||
{
|
||||
UI val;
|
||||
|
||||
if (argc < 3) {
|
||||
fprintf(stdout, "Usage: TESTS C32MAPCONNONE value\n");
|
||||
return(1);
|
||||
}
|
||||
|
||||
val = (UI)atoi(argv[2]);
|
||||
return tests_c32mapconn_value(val, val);
|
||||
}
|
||||
|
||||
static int tests_c32mapconnmatrix(void)
|
||||
{
|
||||
int drive;
|
||||
uint8 connid = 0;
|
||||
uint8 dhandle = 0;
|
||||
uint8 flags = 0;
|
||||
UI values[12];
|
||||
int i;
|
||||
int drive;
|
||||
uint8 hdr[16];
|
||||
uint8 path[0x140];
|
||||
uint8 rep0[0x60];
|
||||
uint8 rep1[0x110];
|
||||
uint8 out[32];
|
||||
UI path_len;
|
||||
uint16 load_ax, res_off, res_seg, tramp_off, tramp_seg, fn_off, fn_seg;
|
||||
uint16 ret_ax, ret_dx, act_lo, act_hi;
|
||||
|
||||
drive = tests_get_current_drive();
|
||||
get_drive_info((uint8)drive, &connid, &dhandle, &flags);
|
||||
|
||||
values[0] = 0;
|
||||
values[1] = 1;
|
||||
values[2] = 2;
|
||||
values[3] = 3;
|
||||
values[4] = 4;
|
||||
values[5] = (UI)connid;
|
||||
values[6] = (UI)dhandle;
|
||||
values[7] = (UI)drive;
|
||||
values[8] = (UI)(drive + 1);
|
||||
values[9] = 0x31;
|
||||
values[10] = 0x3130;
|
||||
values[11] = 0xffff;
|
||||
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 C32MAPCONNMATRIX paged\n");
|
||||
fprintf(stdout, "drive=%c: connid=%u dhandle=%u flags=%02X\n",
|
||||
'A' + drive, connid, dhandle, flags);
|
||||
path_len = tests_build_novell_handle_path(path, dhandle, 0, 0, 1,
|
||||
"LOGIN.EXE", 0, 0);
|
||||
|
||||
memset(rep0, 0, sizeof(rep0));
|
||||
memset(rep1, 0, sizeof(rep1));
|
||||
memset(out, 0, sizeof(out));
|
||||
|
||||
fprintf(stdout, "\nTEST NWREQ87C32RAW label=%u conn32=%04X:%04X\n",
|
||||
label, connHi, connLo);
|
||||
fprintf(stdout, "drive=%c: connid=%u dhandle=%u flags=%02X path_len=%u\n",
|
||||
'A' + drive, connid, dhandle, flags, path_len);
|
||||
tests_dump_bytes("HDR :", hdr, 9);
|
||||
tests_dump_bytes("PATH:", path, path_len > 48 ? 48 : path_len);
|
||||
|
||||
C32_NCP87_Raw_Probe(connLo, connHi,
|
||||
hdr, 9,
|
||||
path, path_len,
|
||||
rep0, 0x4d,
|
||||
rep1, 0x100,
|
||||
out);
|
||||
|
||||
load_ax = tests_get_word_lh(out + 0);
|
||||
res_off = tests_get_word_lh(out + 2);
|
||||
res_seg = tests_get_word_lh(out + 4);
|
||||
tramp_off = tests_get_word_lh(out + 6);
|
||||
tramp_seg = tests_get_word_lh(out + 8);
|
||||
fn_off = tests_get_word_lh(out + 10);
|
||||
fn_seg = tests_get_word_lh(out + 12);
|
||||
ret_ax = tests_get_word_lh(out + 14);
|
||||
ret_dx = tests_get_word_lh(out + 16);
|
||||
act_lo = tests_get_word_lh(out + 18);
|
||||
act_hi = tests_get_word_lh(out + 20);
|
||||
|
||||
fprintf(stdout, "Load AX=%04X Resolver=%04X:%04X Tramp=%04X:%04X\n",
|
||||
load_ax, res_seg, res_off, tramp_seg, tramp_off);
|
||||
fprintf(stdout, "Function COMPAT=%04X:%04X\n", fn_seg, fn_off);
|
||||
fprintf(stdout, "Return DX:AX=%04X:%04X actual=%04X:%04X\n",
|
||||
ret_dx, ret_ax, act_hi, act_lo);
|
||||
tests_dump_bytes("OUT :", out, 22);
|
||||
tests_dump_bytes("REP0:", rep0, 64);
|
||||
tests_dump_bytes("REP1:", rep1, 64);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int tests_nwreq87c32raw(int argc, char *argv[])
|
||||
{
|
||||
UI lo = 0;
|
||||
UI hi = 0;
|
||||
|
||||
if (argc > 2)
|
||||
lo = (UI)atoi(argv[2]);
|
||||
if (argc > 3)
|
||||
hi = (UI)atoi(argv[3]);
|
||||
|
||||
return tests_nwreq87c32raw_one(lo, hi, 0);
|
||||
}
|
||||
|
||||
static int tests_nwreq87c32matrix(void)
|
||||
{
|
||||
UI vals[6];
|
||||
int i;
|
||||
|
||||
vals[0] = 0;
|
||||
vals[1] = 1;
|
||||
vals[2] = 2;
|
||||
vals[3] = 3;
|
||||
vals[4] = 0x31;
|
||||
vals[5] = 0x3130;
|
||||
|
||||
fprintf(stdout, "TEST NWREQ87C32MATRIX paged\n");
|
||||
tests_wait_key();
|
||||
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests_c32mapconn_value(values[i], (UI)i);
|
||||
if (i != 11)
|
||||
for (i = 0; i < 6; i++) {
|
||||
tests_nwreq87c32raw_one(vals[i], 0, (UI)i);
|
||||
if (i != 5)
|
||||
tests_wait_key();
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -1429,16 +1422,6 @@ static int tests_c32primref(void)
|
||||
* NWCVLMREQ(flags=0, regblk, p1=4, p2=43h, p3=0)
|
||||
* if rc==0:
|
||||
* primaryConnRef = regblk.CX
|
||||
*
|
||||
* regblk layout used by NWCVLMREQ:
|
||||
* +00 SI
|
||||
* +02 DS
|
||||
* +04 DI
|
||||
* +06 ES
|
||||
* +08 AX
|
||||
* +0A BX
|
||||
* +0C CX
|
||||
* +0E DX
|
||||
*/
|
||||
tests_set_reg_word(regs, 8, 1); /* AX */
|
||||
|
||||
@@ -1455,10 +1438,10 @@ static int tests_c32primref(void)
|
||||
fprintf(stdout, "primary connection reference candidate CX=%04X decimal=%u\n",
|
||||
primref, primref);
|
||||
|
||||
if (rc == 0)
|
||||
fprintf(stdout, "\nIf CX is non-zero, try it as connLo in NWREQ87C32RAW.\n");
|
||||
else
|
||||
fprintf(stdout, "\nPrimary reference VLM call failed.\n");
|
||||
if (rc == 0 && primref != 0) {
|
||||
fprintf(stdout, "\nNext test:\n");
|
||||
fprintf(stdout, " TESTS NWREQ87C32RAW %u 0\n", primref);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
@@ -1482,18 +1465,18 @@ int func_tests(int argc, char *argv[], int mode)
|
||||
if (tests_same_arg(argv[1], "C32CALLVER2"))
|
||||
return tests_c32callver2();
|
||||
|
||||
if (tests_same_arg(argv[1], "C32MAPCONN"))
|
||||
return tests_c32mapconn();
|
||||
if (tests_same_arg(argv[1], "C32MAPFLAT"))
|
||||
return tests_c32mapflat();
|
||||
|
||||
if (tests_same_arg(argv[1], "C32MAPCONNONE"))
|
||||
return tests_c32mapconnone(argc, argv);
|
||||
|
||||
if (tests_same_arg(argv[1], "C32MAPCONNMATRIX"))
|
||||
return tests_c32mapconnmatrix();
|
||||
if (tests_same_arg(argv[1], "NWREQ87C32RAW"))
|
||||
return tests_nwreq87c32raw(argc, argv);
|
||||
|
||||
if (tests_same_arg(argv[1], "C32PRIMREF"))
|
||||
return tests_c32primref();
|
||||
|
||||
if (tests_same_arg(argv[1], "NWREQ87C32MATRIX"))
|
||||
return tests_nwreq87c32matrix();
|
||||
|
||||
if (tests_same_arg(argv[1], "NWREQ87"))
|
||||
return tests_nwreq87(argc, argv);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user