Hi Eric, thanks for help, Eric Auer wrote: > > Hi Franta, > >> struct dosemu_detect { >> char magic[8]; >> unsigned char ver[4]; >> }; >> static struct dosemu_detect far *p = (void far*) 0xF000FFE0; > > Note that the way how you create far pointers can differ > between compilers. In particular, with any 32 bit memory > model, things would look quite differently. Just saying.
Pointers and things around them are for me still a little incomprehensible ;) >> char magicexp[]="$DOSEMU$"; // expected string when on >> DOSEMU >> >> if (strcmp(p->magic, magicexp)) // p->magic == "$DOSEMU$" ? > > You cannot strcmp this because the string is no C style > string with a NUL character at the end. You could use > strncmp(string1, string2, 8) to compare only the first > eight bytes, which will probably work fine for you :-) But 'magicexp' is null-terminated string, yes? Then comparison should stop at its length (or before, when p->magic is different or has null-byte before strlen(magicexp) ), I suppose that. And I tried to use some as strncmp(p->magic, magicexp, strlen(magicexp)) too and it also was not working. But I definitely think it has some with memory models or needs for same data segment for both strcmp() arguments - until now I've noticed OpenWatcom C library has functions for far pointer arguments ( _fstrcmp/_fstrcat/_fstrlen/_fstrstr/...) and when I use '_fstrcmp' instead of 'strcmp', then detection works well. >> (I'm using tiny memory model and link .COM instead of .EXE, for >> minimalize program size) > > PS: I do not know if int 0xe6 is really deprecated. Anybody? In my first mail referenced FreeDOS thread: http://marc.info/?l=freedos-dev&m=88425176918117&w=2 Hans Lermen wrote about it: "This detection method is abandoned, future DOSEMU versions will even (intentionally) refuse to run, when INTE6 AH=0 is called." >> (and curiously, in referenced thread deprecated method Int 0xE6 AH=0 >> still /after ~17 years/ is supported and seems be working well) Maybe DOSEMU development team changed this decision (or simply leave it here). -- Thanks, Franta Hanzlik ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Freedos-user mailing list Freedos-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-user