Added VirtualAllocEx.

This commit is contained in:
Andreas Mohr 2000-09-16 20:50:36 +00:00 committed by Alexandre Julliard
parent ecdde38906
commit 5bb74648d8
2 changed files with 23 additions and 2 deletions

View File

@ -915,7 +915,7 @@ import ntdll.dll
896 stub SwitchToFiber
897 stub SwitchToThread
898 stdcall TryEnterCriticalSection(ptr) TryEnterCriticalSection
899 stub VirtualAllocEx
899 stdcall VirtualAllocEx(long ptr long long long) VirtualAllocEx
900 stub VirtualFreeEx
901 stub WriteFileGather

View File

@ -700,11 +700,12 @@ LPVOID WINAPI VirtualAlloc(
WARN("MEM_TOP_DOWN ignored\n");
type &= ~MEM_TOP_DOWN;
}
/* Compute the protection flags */
/* Compute the alloc type flags */
if (!(type & (MEM_COMMIT | MEM_RESERVE | MEM_SYSTEM)) ||
(type & ~(MEM_COMMIT | MEM_RESERVE | MEM_SYSTEM)))
{
ERR("called with wrong alloc type flags (%08lx) !\n", type);
SetLastError( ERROR_INVALID_PARAMETER );
return NULL;
}
@ -774,6 +775,25 @@ LPVOID WINAPI VirtualAlloc(
}
/***********************************************************************
* VirtualAllocEx (KERNEL32.548)
*
* Seems to be just as VirtualAlloc, but with process handle.
*/
LPVOID WINAPI VirtualAllocEx(
HANDLE hProcess, /* [in] Handle of process to do mem operation */
LPVOID addr, /* [in] Address of region to reserve or commit */
DWORD size, /* [in] Size of region */
DWORD type, /* [in] Type of allocation */
DWORD protect /* [in] Type of access protection */
) {
if (MapProcessHandle( hProcess ) == GetCurrentProcessId())
return VirtualAlloc( addr, size, type, protect );
ERR("Unsupported on other process\n");
return NULL;
}
/***********************************************************************
* VirtualFree (KERNEL32.550)
* Release or decommits a region of pages in virtual address space.
@ -809,6 +829,7 @@ BOOL WINAPI VirtualFree(
if ((type != MEM_DECOMMIT) && (type != MEM_RELEASE))
{
ERR("called with wrong free type flags (%08lx) !\n", type);
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}