1. peek and poke under Windows XP
- Posted by George Orr <georgeorr at donet.com> Mar 28, 2002
- 465 views
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..... Thanks!
2. Re: peek and poke under Windows XP
- Posted by Martin Stachon <martin.stachon at worldonline.cz> Mar 29, 2002
- 463 views
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
3. Re: peek and poke under Windows XP
- Posted by euman at bellsouth.net Mar 29, 2002
- 451 views
----- Original Message ----- From: "George Orr" <georgeorr at donet.com> Subject: RE: peek and poke under Windows XP > 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 Oh yeah, I see now. if a string is shorter than 22 then you'll be trying to peek( ) locations that are possibly protected by the system. You will need to only peek( ) the strings length + 1. Have you already done this? personally, I think this is your problem Euman > > 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
4. Re: peek and poke under Windows XP
- Posted by Martin Stachon <martin.stachon at worldonline.cz> Mar 30, 2002
- 457 views
George Orr <georgeorr at donet.com> writes: > 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! No more the DOS days when you could do everything with the machine... > Thanks for your help. Please let me know if you see anything else that > may be causing this. The other way to fix is to replace get_word(): function get_word(atom a) integer i,char sequence s i = 0 s = "" while 1 do char = peek(a+i) if char = 0 then -- end of string exit else s &= char i += 1 end if end while return s end function -- Martin