tests
This commit is contained in:
135
nwtests.c
135
nwtests.c
@@ -1932,6 +1932,138 @@ static int tests_nwreq87c32raw5(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
static unsigned long tests_get_dword_be_local(uint8 *p)
|
||||
{
|
||||
return (((unsigned long)p[0]) << 24) |
|
||||
(((unsigned long)p[1]) << 16) |
|
||||
(((unsigned long)p[2]) << 8) |
|
||||
((unsigned long)p[3]);
|
||||
}
|
||||
|
||||
static unsigned long tests_get_dword_le_local(uint8 *p)
|
||||
{
|
||||
return ((unsigned long)p[0]) |
|
||||
(((unsigned long)p[1]) << 8) |
|
||||
(((unsigned long)p[2]) << 16) |
|
||||
(((unsigned long)p[3]) << 24);
|
||||
}
|
||||
|
||||
static int tests_ncp87c32auto(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;
|
||||
|
||||
drive = tests_get_current_drive();
|
||||
get_drive_info((uint8)drive, &connid, &dhandle, &flags);
|
||||
|
||||
fprintf(stdout, "TEST NCP87C32AUTO\n");
|
||||
fprintf(stdout, "Auto Client32 path: MAPVAR len=4 flag=0 -> OPENREF -> NCP87/S6\n");
|
||||
fprintf(stdout, "drive=%c: connid=%u dhandle=%u flags=%02X\n",
|
||||
'A' + drive, connid, dhandle, flags);
|
||||
|
||||
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); /* connRefLocal */
|
||||
cref_hi = tests_get_word_lh(mapout + 24);
|
||||
|
||||
fprintf(stdout, "\nSTEP1 C32MAPVAR 4 0\n");
|
||||
fprintf(stdout, "Return DX:AX=%04X:%04X connRefLocal=%04X:%04X\n",
|
||||
map_ret_dx, map_ret_ax, cref_hi, cref_lo);
|
||||
tests_dump_bytes("MAP OUT:", mapout, 26);
|
||||
|
||||
if (map_ret_ax != 0 || map_ret_dx != 0 || (cref_lo == 0 && cref_hi == 0)) {
|
||||
fprintf(stdout, "MAP step failed or returned empty connRef.\n");
|
||||
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);
|
||||
|
||||
fprintf(stdout, "\nSTEP2 C32OPENREF %u %u\n", cref_lo, cref_hi);
|
||||
fprintf(stdout, "Return DX:AX=%04X:%04X handle=%04X:%04X\n",
|
||||
open_ret_dx, open_ret_ax, handle_hi, handle_lo);
|
||||
tests_dump_bytes("OPEN OUT:", openout, 22);
|
||||
|
||||
if (open_ret_ax != 0 || open_ret_dx != 0 || (handle_lo == 0 && handle_hi == 0)) {
|
||||
fprintf(stdout, "OPENREF failed or returned empty handle.\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); /* 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);
|
||||
|
||||
fprintf(stdout, "\nSTEP3 NWREQ87C32RAW5 handle=%04X:%04X\n",
|
||||
handle_hi, handle_lo);
|
||||
fprintf(stdout, "Return DX:AX=%04X:%04X actual=%04X:%04X\n",
|
||||
raw_ret_dx, raw_ret_ax, actual_hi, actual_lo);
|
||||
tests_dump_bytes("RAW OUT:", rawout, 22);
|
||||
tests_dump_bytes("REP0:", rep0, 80);
|
||||
tests_dump_bytes("REP1:", rep1, 64);
|
||||
|
||||
if (raw_ret_ax == 0 && raw_ret_dx == 0) {
|
||||
fprintf(stdout, "\nNCP87C32AUTO OK\n");
|
||||
fprintf(stdout, "attr guess BE dword[0]=%08lX LE dword[0]=%08lX\n",
|
||||
tests_get_dword_be_local(rep0 + 0),
|
||||
tests_get_dword_le_local(rep0 + 0));
|
||||
fprintf(stdout, "dword[4] BE=%08lX LE=%08lX\n",
|
||||
tests_get_dword_be_local(rep0 + 4),
|
||||
tests_get_dword_le_local(rep0 + 4));
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int func_tests(int argc, char *argv[], int mode)
|
||||
{
|
||||
if (argc >= 2) {
|
||||
@@ -1956,6 +2088,9 @@ int func_tests(int argc, char *argv[], int mode)
|
||||
if (tests_same_arg(argv[1], "NWREQ87C32RAW"))
|
||||
return tests_nwreq87c32raw(argc, argv);
|
||||
|
||||
if (tests_same_arg(argv[1], "NCP87C32AUTO"))
|
||||
return tests_ncp87c32auto();
|
||||
|
||||
if (tests_same_arg(argv[1], "NWREQ87C32RAW5"))
|
||||
return tests_nwreq87c32raw5(argc, argv);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user