Page 1 of 1

*memoryptr with AllocateMemory

Posted: Wed Nov 26, 2014 4:29 pm
by Duffer123
Just wondering whether there was any way to fix an AllocateMemory patch of memory to a particular point(er) in the memory rather than just being assigned back *memoryID? (if you see what I mean)

Re: *memoryptr with AllocateMemory

Posted: Wed Nov 26, 2014 4:45 pm
by Tenaja
Your *memoryptr is a particular pointer in memory. You may need to rephrase your question.

If you are wanting to preselect the location, then you will likely need to do that with API, IF it is possible. PB's command does not allow it.

Re: *memoryptr with AllocateMemory

Posted: Wed Nov 26, 2014 4:47 pm
by Duffer123
@ Tenaja,

What I want to do is say an AllocateMemory of say 1000 bytes is at xxx pointer in memory rather than have Purebasic allocate me the pointer in memory at which that AllocateMemory is.... hope that makes more sense?

Re: *memoryptr with AllocateMemory

Posted: Wed Nov 26, 2014 4:50 pm
by infratec
I think you want to point to somewhere in the memory of the PC.

That's, in general, not allowed by windows.
It is only possible with a lot of knowledge of windows kernel stuff.

Bernd

Re: *memoryptr with AllocateMemory

Posted: Wed Nov 26, 2014 7:02 pm
by IdeasVacuum
That is perhaps because you need to share memory with another app? It can be done with CreateFileMapping_() on Windows OS.

Re: *memoryptr with AllocateMemory

Posted: Wed Nov 26, 2014 7:14 pm
by Duffer123
@ IdeasVacuum,

Could you perhaps add a little more info about that?

(thanks in advance)

Re: *memoryptr with AllocateMemory

Posted: Wed Nov 26, 2014 7:27 pm
by juror
If you already have a memory pointer, you can attempt a memory access operation e.g. peek, poke and see if the OS will let you access it.

If you can't access it then the pointer is really of little use.