Add Wine-internal allocation type MEM_SYSTEM for VirtualAlloc to

register external mappings (like video frame buffers).
This commit is contained in:
Ove Kaaven 2000-04-29 16:45:56 +00:00 committed by Alexandre Julliard
parent f61d7e0a24
commit bda3e66201
2 changed files with 15 additions and 7 deletions

View File

@ -909,6 +909,9 @@ typedef DWORD (WINAPI *LPPROGRESS_ROUTINE)(LARGE_INTEGER, LARGE_INTEGER, LARGE_I
#define MEM_PRIVATE 0x00020000
#define MEM_MAPPED 0x00040000
#define MEM_TOP_DOWN 0x00100000
#ifdef __WINE__
#define MEM_SYSTEM 0x80000000
#endif
#define SEC_FILE 0x00800000
#define SEC_IMAGE 0x01000000

View File

@ -256,6 +256,7 @@ static FILE_VIEW *VIRTUAL_CreateView( UINT base, UINT size, UINT offset,
static void VIRTUAL_DeleteView(
FILE_VIEW *view /* [in] View */
) {
if (!(view->flags & VFLAG_SYSTEM))
FILE_munmap( (void *)view->base, 0, view->size );
if (view->next) view->next->prev = view->prev;
if (view->prev) view->prev->next = view->next;
@ -598,13 +599,13 @@ LPVOID WINAPI VirtualAlloc(
}
/* Compute the protection flags */
if (!(type & (MEM_COMMIT | MEM_RESERVE)) ||
(type & ~(MEM_COMMIT | MEM_RESERVE)))
if (!(type & (MEM_COMMIT | MEM_RESERVE | MEM_SYSTEM)) ||
(type & ~(MEM_COMMIT | MEM_RESERVE | MEM_SYSTEM)))
{
SetLastError( ERROR_INVALID_PARAMETER );
return NULL;
}
if (type & MEM_COMMIT)
if (type & (MEM_COMMIT | MEM_SYSTEM))
vprot = VIRTUAL_GetProt( protect ) | VPROT_COMMITTED;
else vprot = 0;
@ -613,6 +614,9 @@ LPVOID WINAPI VirtualAlloc(
if ((type & MEM_RESERVE) || !base)
{
view_size = size + (base ? 0 : granularity_mask + 1);
if (type & MEM_SYSTEM)
ptr = base;
else
ptr = (UINT)FILE_dommap( -1, (LPVOID)base, 0, view_size, 0, 0,
VIRTUAL_GetUnixProt( vprot ), MAP_PRIVATE );
if (ptr == (UINT)-1)
@ -642,7 +646,8 @@ LPVOID WINAPI VirtualAlloc(
SetLastError( ERROR_INVALID_ADDRESS );
return NULL;
}
if (!(view = VIRTUAL_CreateView( ptr, size, 0, 0, vprot, -1 )))
if (!(view = VIRTUAL_CreateView( ptr, size, 0, (type & MEM_SYSTEM) ?
VFLAG_SYSTEM : 0, vprot, -1 )))
{
FILE_munmap( (void *)ptr, 0, size );
SetLastError( ERROR_OUTOFMEMORY );