Category : Files from Magazines
Archive   : PCTJ8707.ZIP
Filename : MEMCHK.C

 
Output of file : MEMCHK.C contained in archive : PCTJ8707.ZIP
/*
* memchk -- look for random-access memory at
* a specified location; return non-zero if found
*/

#include
#include

int
memchk(seg, os)
unsigned int seg;
unsigned int os;
{
unsigned char tstval, oldval, newval;
unsigned int ds;
struct SREGS segregs;

/* get value of current data segment */
segread(&segregs);
ds = segregs.ds;
/* save current contents of test location */
movedata(seg, os, ds, (unsigned)&oldval, 1);
/* copy a known value into test location */
tstval = 0xFC;
movedata(ds, (unsigned)&tstval, seg, os, 1);
/* read test value back and comapre to value written */
movedata(seg, os, ds, (unsigned)&newval, 1);
if (newval != tstval)
return (0);

/* restore original contents of test location */
movedata(ds, (unsigned)&oldval, seg, os, 1);

return (1);
}


  3 Responses to “Category : Files from Magazines
Archive   : PCTJ8707.ZIP
Filename : MEMCHK.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/