RE: AfxIsValidAddress equivalent, test valid memory
RE: AfxIsValidAddress equivalent, test valid memory
- Subject: RE: AfxIsValidAddress equivalent, test valid memory
- From: "Alex Sheh" <email@hidden>
- Date: Fri, 7 Jul 2006 13:49:25 -0700
- Thread-topic: AfxIsValidAddress equivalent, test valid memory
Thank you Brendan, this is exactly what I needed.
- Alex
-----Original Message-----
From: Brendan Creane [mailto:email@hidden]
Sent: Thursday, June 29, 2006 11:07 AM
To: email@hidden
Cc: Alex Sheh
Subject: Re: AfxIsValidAddress equivalent, test valid memory
Oops, forgot to free the malloc'ed memory (never did that before:-)
-brendan
Boolean
memIsValid(vm_address_t m_addr, size_t numOfBytes) {
vm_address_t dstPtr =
(vm_address_t)malloc(numOfBytes);
mach_port_t thisTask = mach_task_self();
vm_size_t sizeRead = numOfBytes;
int err;
err = vm_read_overwrite(thisTask, m_addr, numOfBytes, dstPtr,
&sizeRead);
if (err == noErr && sizeRead != numOfBytes)
err = -1;
free ((void*)dstPtr); // !!
return (err == noErr);
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden