This commit is contained in:
Mario Fetka
2026-05-23 21:47:50 +02:00
parent 6892666807
commit e4a5251a0b

139
nwtests.c
View File

@@ -2064,6 +2064,111 @@ static int tests_ncp87c32auto(void)
}
static int tests_ncp87c32attr(void)
{
uint8 connid = 0;
uint8 dhandle = 0;
uint8 flags = 0;
int drive;
uint8 mapout[32];
uint8 openout[32];
uint8 rawout[32];
uint16 map_ret_ax, map_ret_dx;
uint16 cref_lo, cref_hi;
uint16 open_ret_ax, open_ret_dx;
uint16 handle_lo, handle_hi;
uint16 raw_ret_ax, raw_ret_dx;
uint16 actual_lo, actual_hi;
uint8 hdr[16];
uint8 path[0x140];
uint8 rep0[0x60];
uint8 rep1[0x110];
UI path_len;
unsigned long attr;
drive = tests_get_current_drive();
get_drive_info((uint8)drive, &connid, &dhandle, &flags);
/*
* Client32 path confirmed:
* C32_MapVar_Probe(4,0) -> connRefLocal FFFF:FFFE
* C32_OpenRef_Probe(connRefLocal) -> handle 0101:0001
* C32_NCP87_Raw5_Probe(handle) -> NCP87/S6 works
*
* No VLM mapper/debug calls are used here.
*/
memset(mapout, 0, sizeof(mapout));
C32_MapVar_Probe(4, 0, mapout);
map_ret_ax = tests_get_word_lh(mapout + 14);
map_ret_dx = tests_get_word_lh(mapout + 16);
cref_lo = tests_get_word_lh(mapout + 22);
cref_hi = tests_get_word_lh(mapout + 24);
if (map_ret_ax != 0 || map_ret_dx != 0 || (cref_lo == 0 && cref_hi == 0)) {
fprintf(stdout, "C32 attr: map failed rc=%04X:%04X\n", map_ret_dx, map_ret_ax);
return(1);
}
memset(openout, 0, sizeof(openout));
C32_OpenRef_Probe(cref_lo, cref_hi, openout);
open_ret_ax = tests_get_word_lh(openout + 14);
open_ret_dx = tests_get_word_lh(openout + 16);
handle_lo = tests_get_word_lh(openout + 18);
handle_hi = tests_get_word_lh(openout + 20);
if (open_ret_ax != 0 || open_ret_dx != 0 || (handle_lo == 0 && handle_hi == 0)) {
fprintf(stdout, "C32 attr: openref failed rc=%04X:%04X ref=%04X:%04X\n",
open_ret_dx, open_ret_ax, cref_hi, cref_lo);
return(1);
}
memset(hdr, 0, sizeof(hdr));
hdr[0] = 6;
hdr[1] = 0;
hdr[2] = 0;
tests_put_word_lh(hdr + 3, 0x0006); /* subfunction 6 */
tests_put_dword_lh(hdr + 5, 0x00000004UL); /* RIM_ATTRIBUTES */
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(rawout, 0, sizeof(rawout));
C32_NCP87_Raw5_Probe(handle_lo, handle_hi,
hdr, 9,
path, path_len,
rep0, 0x4d,
rep1, 0x100,
rawout);
raw_ret_ax = tests_get_word_lh(rawout + 14);
raw_ret_dx = tests_get_word_lh(rawout + 16);
actual_lo = tests_get_word_lh(rawout + 18);
actual_hi = tests_get_word_lh(rawout + 20);
if (raw_ret_ax != 0 || raw_ret_dx != 0) {
fprintf(stdout, "C32 attr: ncp87 failed rc=%04X:%04X actual=%04X:%04X\n",
raw_ret_dx, raw_ret_ax, actual_hi, actual_lo);
return(1);
}
/* In the verified reply, RIM_ATTRIBUTES is the little-endian dword at REP0+4. */
attr = tests_get_dword_le_local(rep0 + 4);
fprintf(stdout, "NCP87C32ATTR LOGIN.EXE attr=%02lX handle=%04X:%04X actual=%04X\n",
attr & 0xffUL, handle_hi, handle_lo, actual_lo);
return(0);
}
int func_tests(int argc, char *argv[], int mode)
{
if (argc >= 2) {
@@ -2085,8 +2190,8 @@ int func_tests(int argc, char *argv[], int mode)
if (tests_same_arg(argv[1], "C32MAPFLAT"))
return tests_c32mapflat();
if (tests_same_arg(argv[1], "NWREQ87C32RAW"))
return tests_nwreq87c32raw(argc, argv);
if (tests_same_arg(argv[1], "NCP87C32ATTR"))
return tests_ncp87c32attr();
if (tests_same_arg(argv[1], "NCP87C32AUTO"))
return tests_ncp87c32auto();
@@ -2094,36 +2199,6 @@ int func_tests(int argc, char *argv[], int mode)
if (tests_same_arg(argv[1], "NWREQ87C32RAW5"))
return tests_nwreq87c32raw5(argc, argv);
if (tests_same_arg(argv[1], "C32PRIMREF"))
return tests_c32primref();
if (tests_same_arg(argv[1], "C32OPENREF"))
return tests_c32openref(argc, argv);
if (tests_same_arg(argv[1], "C32MAPCONNONE"))
return tests_c32mapconnone(argc, argv);
if (tests_same_arg(argv[1], "C32SCANFIRST"))
return tests_c32scanfirst();
if (tests_same_arg(argv[1], "C32SCANREFS2"))
return tests_c32scanrefs2();
if (tests_same_arg(argv[1], "C32SCANITER"))
return tests_c32scaniter(argc, argv);
if (tests_same_arg(argv[1], "C32MAPFULL"))
return tests_c32mapfull();
if (tests_same_arg(argv[1], "C32MAPFULL2"))
return tests_c32mapfull2();
if (tests_same_arg(argv[1], "C32MAPVAR"))
return tests_c32mapvar(argc, argv);
if (tests_same_arg(argv[1], "C32MAPVARMATRIX"))
return tests_c32mapvarmatrix();
if (tests_same_arg(argv[1], "NWREQ87C32MATRIX"))
return tests_nwreq87c32matrix();