This commit is contained in:
Mario Fetka
2026-05-23 17:48:55 +02:00
parent 64ab3a4fab
commit 7f4dd3b429
3 changed files with 79 additions and 59 deletions

View File

@@ -1218,42 +1218,43 @@ static int tests_c32getfunc(void)
}
static int tests_c32callver(void)
static int tests_c32callver2(void)
{
uint8 out[32];
uint16 load_ax;
uint16 res_off, res_seg;
uint16 tramp_off, tramp_seg;
uint16 fn_off, fn_seg;
uint16 call_ax, call_dx, flags;
memset(out, 0, sizeof(out));
fprintf(stdout, "TEST C32CALLVER\n");
fprintf(stdout, "Resolve and call CLIENT32GetVersion with zero args\n\n");
fprintf(stdout, "TEST C32CALLVER2\n");
fprintf(stdout, "Call CLIENT32GetVersion through ECX NIOS trampoline\n\n");
C32_CallName0_Probe("CLIENT32GetVersion", out);
C32_CallVersion_Nios_Probe(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);
fn_off = tests_get_word_lh(out + 6);
fn_seg = tests_get_word_lh(out + 8);
call_ax = tests_get_word_lh(out + 10);
call_dx = tests_get_word_lh(out + 12);
flags = tests_get_word_lh(out + 14);
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);
call_ax = tests_get_word_lh(out + 14);
call_dx = tests_get_word_lh(out + 16);
flags = tests_get_word_lh(out + 18);
fprintf(stdout, "Load AX=%04X\n", load_ax);
fprintf(stdout, "Resolver=%04X:%04X\n", res_seg, res_off);
fprintf(stdout, "Resolver=%04X:%04X Trampoline=%04X:%04X\n",
res_seg, res_off, tramp_seg, tramp_off);
fprintf(stdout, "Function=%04X:%04X\n", fn_seg, fn_off);
fprintf(stdout, "Call returned DX:AX=%04X:%04X FLAGS=%04X\n",
call_dx, call_ax, flags);
tests_dump_bytes("RAW:", out, 16);
if (fn_off || fn_seg)
fprintf(stdout, "\nFunction pointer resolved.\n");
if (call_ax || call_dx)
fprintf(stdout, "Call returned non-zero version value.\n");
tests_dump_bytes("RAW:", out, 20);
if (load_ax == 0 && (fn_off || fn_seg))
fprintf(stdout, "\nNIOS trampoline path resolved successfully.\n");
return(0);
}
@@ -1273,8 +1274,8 @@ int func_tests(int argc, char *argv[], int mode)
if (tests_same_arg(argv[1], "C32GETFUNC"))
return tests_c32getfunc();
if (tests_same_arg(argv[1], "C32CALLVER"))
return tests_c32callver();
if (tests_same_arg(argv[1], "C32CALLVER2"))
return tests_c32callver2();
if (tests_same_arg(argv[1], "NWREQ87"))
return tests_nwreq87(argc, argv);