Hallo allen,
Ik ben een programma aan het schrijven waarin ik VirtualAllocEx nodig heb. Volgens mijn informatie moet de 2e parameter een HModule zijn (en dit klopt echt, want in een C-code die ik heb werkt het wel). Echter krijg ik het niet voor elkaar om dit op een juiste manier te typecasten. Hier is wat ik wil doen:
waar de parameter hierboven nil is moet CModule komen te staan, maar ik krijg dit niet voor elkaar zonder errors. Weet iemand hoe ik dit op een juiste manier moet typecasten?
hier nog een stukje uit de delphi-help over de virtualallocex functie:
The VirtualAllocEx function reserves, commits, or both, a region of memory within the virtual address space of a specified process. The function initializes the memory it allocates to zero.
The difference between the VirtualAllocEx function and the VirtualAlloc function is that VirtualAlloc allocates memory within the address space of the calling process, while VirtualAllocEx lets you specify a process.
LPVOID VirtualAllocEx(
HANDLE hProcess, // process within which to allocate memory
LPVOID lpAddress, // desired starting address of allocation
DWORD dwSize, // size, in bytes, of region to allocate
DWORD flAllocationType, // type of allocation
DWORD flProtect // type of access protection
);
Ik ben een programma aan het schrijven waarin ik VirtualAllocEx nodig heb. Volgens mijn informatie moet de 2e parameter een HModule zijn (en dit klopt echt, want in een C-code die ik heb werkt het wel). Echter krijg ik het niet voor elkaar om dit op een juiste manier te typecasten. Hier is wat ik wil doen:
code:
1
2
3
4
5
6
| var
CModule: HModule;
begin
CModule := 0;
CModule := GetmoduleHandle (Nil);
pMem := VirtualAllocEx (hProcess, nil, dwSize, MEM_COMMIT or MEM_RESERVE,PAGE_EXECUTE_READWRITE); |
waar de parameter hierboven nil is moet CModule komen te staan, maar ik krijg dit niet voor elkaar zonder errors. Weet iemand hoe ik dit op een juiste manier moet typecasten?
hier nog een stukje uit de delphi-help over de virtualallocex functie:
The VirtualAllocEx function reserves, commits, or both, a region of memory within the virtual address space of a specified process. The function initializes the memory it allocates to zero.
The difference between the VirtualAllocEx function and the VirtualAlloc function is that VirtualAlloc allocates memory within the address space of the calling process, while VirtualAllocEx lets you specify a process.
LPVOID VirtualAllocEx(
HANDLE hProcess, // process within which to allocate memory
LPVOID lpAddress, // desired starting address of allocation
DWORD dwSize, // size, in bytes, of region to allocate
DWORD flAllocationType, // type of allocation
DWORD flProtect // type of access protection
);
[ Voor 3% gewijzigd door Verwijderd op 06-05-2003 16:55 ]