The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Jimg on June 21, 2005, 05:44:43 PM

Title: Out of bounds
Post by: Jimg on June 21, 2005, 05:44:43 PM
Is there some quick way to find out the last valid address I may access without causing and exception or fault?  I'm asking to find some way for the general purpose routines that pick up 4 or 8 bytes at a time to know when to stop.
Title: Re: Out of bounds
Post by: AeroASM on June 21, 2005, 08:28:58 PM
As long as you remain within a single page, the permissions do not change. Therefore you are alirght if you don't cross page boundaries.
Title: Re: Out of bounds
Post by: Jimg on June 21, 2005, 08:39:26 PM
And if I find I that the next access of 4 or 8 bytes would cross a page boundary, how can I tell if my space actually ends at the end of the page or not?
Title: Re: Out of bounds
Post by: AeroASM on June 21, 2005, 09:05:24 PM
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/virtualquery.asp
Title: Re: Out of bounds
Post by: Jimg on June 21, 2005, 11:56:14 PM
Thanks.