Hi all, I'm trying to write a small program that will distinguish whether running under dosemu/FreeDOS or not, and accordingly do other things. I ran into problems which I can not solve, so please, if someone here will be able to help. I'm using Open Watcom C 1.9 compiler on FreeDOS 1.1. And it is one of my first C programs, thus please excuse my ignorance.
I perform Dosemu detection according to instruction and example in this old FreeDOS maillist thread: http://marc.info/?l=freedos-dev&m=88425176918117&w=2 But when my program look as: #include <string.h> // strcmp, strrchr, strncat, strlen int main(int argc, char const *argv[]) { struct dosemu_detect { char magic[8]; unsigned char ver[4]; }; static struct dosemu_detect far *p = (void far*) 0xF000FFE0; char magicexp[]="$DOSEMU$"; // expected string when on DOSEMU if (strcmp(p->magic, magicexp)) // p->magic == "$DOSEMU$" ? {... then result if always false - even when running on Dosemu/FreeDOS, strcmp return '-1', as if "$DOSEMU$" magic was not at 0xF000FFE0. But it is, because when i rewrote this to: int ii,dexist=0; for (ii=0; ii < sizeof(p->magic); ii++) if (p->magic[ii] != magicexp[ii]) dexist++; then Dosemu detection works OK. Where can be problem? One thing I could think of - maybe strcmp() expect same segment register for both its arguments? (I'm using tiny memory model and link .COM instead of .EXE, for minimalize program size) (and curiously, in referenced thread deprecated method Int 0xE6 AH=0 still /after ~17 years/ is supported and seems be working well) Thanks for any help in advance, 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