Re: Missing library
- Posted by rudy toews <rltoews at ilos.net> Jul 13, 2004
- 817 views
Pete Lomax wrote: Thinking out loud here, I'd like to see a program self-verify it has > the correct/expected/supported include files. > > I'm thinking eg: > > constant validate_self=0, checksum=#00000000 > procedure validate() > integer c > c=read_file_and_build_checksum() > if validate_self then > if c!=(checksum) then > error("wrong version of ...") > abort(1) > end if > else > seek(24?) > printf(1,"1,checksum=#%08x",c) > puts(1,"new checksum generated") > end if > end procedure > validate() > > The idea is that the programmer (manually) edits validate_self to 0, > tests the program, then ships the automatically-self-modified files. > > Thoughts anyone? > Pete > > PS You could also ([1] see below) have eg: > > include selftest.e > --nclude w0591.ew > include w0592.ew > --nclude w0600.ew > --nclude win32lib.ew > > and each time it runs it patches a "--" with "in" at random, except > for the final release when it leaves it as win32lib.ew > Admittedly, in the case of win32lib, checking the value of > Win32LibVersion (against a table of allowed values) is obviously much > better than a crc, but you don't necessarily have that luxury on all > third party components your app uses. > > [1] I don't really rate the idea of supporting multiple versions of a > lib, but this self-verify idea may need to be a bit more general > purpose than my or anyone else's specific needs. I daresay this random > patching could easily cause severe programmer difficulties, such is > the burden of supporting multiple lib versions. > i like this self checking idea. thinking outloud here too ... maybe as a constant, a sequence of all the include statements. can be looked for in the binary code or interpreted source. with the line number they should be on, or memory address? i i have also been pondering how to add a little AI to programs to self validate. an alternate form of anti-virus protection. instead of having to maintain a list of virus programs, simplify by having program check itself for flaws. 'picking oneself up by ones own bootstraps' so virus programs would fail to infect in the first place, some randomness must be used to do this. yet still be recognized by the program and yet ignored by the virus. no concrete outline of idea yet, still bouncing it around inside my head. i work 8pm- 4a.m., so it takes a lot of bouncing to get thoughts straight. later rudy