RE: peek and poke under Windows XP

new topic     » topic index » view thread      » older message » newer message

Martin -

I am trying to create functions to rapidly put and get strings from 
memory using allocate_string() and peek.  The basic functions are

constant maxlength = 22    -- maximum length of word in dictionary

function put_word(sequence word)
  atom aword
  aword = allocate_string(word)
  return aword
end function

function get_word(atom a)
  sequence w
  integer i
  w = peek({a,maxlength})
  i = 1
  while w[i]>0 do i += 1 end while
  return w[1..i-1]
end function

The above functions work in Windows XP using ex.exe or exw.exe with 
trace turned on.  Using under exw.exe without trace gives system errors. 
 As you suggested, this seems to be an XP Virtual Machine issue.  The 
peek({a,maxlength}) accesses memory that has not been allocated.  Using 
ex.exe or exw.exe with trace on, this returns junk in the later bytes of 
the string, but the original string can be recovered by searching for 
the first 0 byte.  Apparently the XP virutal machine objects to 
accessing memory that has not been allocated.  When I modify the 
put_word function to pad the string to length maxlength, everything 
works in exw.exe.  

blankstr = repeat(0,maxlength)
function put_word(sequence word)
  atom aword
  sequence bword
  bword = blankstr
  for i = 1 to length(word) do
    bword[i] = word[i]
  end for
  aword = allocate_string(bword)
  return aword
end function

There may be other problems with my coding, but it looks like the XP 
Virtual Machine may just be too smart for me!

Thanks for your help.  Please let me know if you see anything else that 
may be causing this.

  George

Martin Stachon wrote:
> From: "George Orr" <georgeorr at donet.com>
> > Has anyone had trouble with peek and poke when running EXW.EXE under 
> > Windows XP?  I have a simple program which runs fine under EX.EXE but 
> > has a fatal error under EXW.EXE.  From EXW.EXE it runs fine with trace 
> > and trace(1), but not with trace(0).
> > 
> > This may have been discussed before, but suddenly I can't get the 
> > Tropican search to find anything in our list.....
> 
> Could you provide us the program? I guess the program has a little bug
> (it could be a one byte array overflow) which doesn't come out with DOS, 
> but
> is caught by XP.
> 
>     Martin
> 
>

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu