🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #2859

Memory guard, how to do it?

#2859
From: tinyabs
Date: Tue, 12 Dec 2006 01:07
16 lines
1474 bytes
The scenario is like this:

I have allocated memory buffer and like to mark none read/write/execute at 
the beginning and end of the buffer.

0x00600000-4K size [None-read/write/execute]
0x00601000-256K size [valid memory buffer]
0x00641000-4K size [none read/write/execute]

I'm doing this because I have a graphics engine that uses assembly language 
to read and write to the buffer. I want an access violation exception when I 
access memory outside of buffer.

My idea is to use VirtualAlloc to allocate the memory and then use 
VirtualProtect to change the attributes. Is this a viable way to do it or is 
there a shortcut?
Technical Details
Message-ID: <457e0082$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,e965a36da9329840,start
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "tinyabs" <nospam@me.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Memory guard, how to do it?
Date: Tue, 12 Dec 2006 09:07:09 +0800
Lines: 18
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 222.164.221.72
Message-ID: <457e0082$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1165885570 222.164.221.72 (11 Dec 2006 17:06:10 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail