Removed MEM_MAPPED_FILE_Ops.

This commit is contained in:
Alexandre Julliard 1999-02-21 18:28:40 +00:00
parent 2f07306eaf
commit d6cb784269
2 changed files with 3 additions and 32 deletions

View File

@ -31,7 +31,6 @@
typedef struct typedef struct
{ {
K32OBJ header; K32OBJ header;
K32OBJ *file;
} FILE_MAPPING; } FILE_MAPPING;
/* File view */ /* File view */
@ -94,13 +93,6 @@ static UINT32 granularity_mask; /* Allocation granularity (usually 64k) */
#define ROUND_SIZE(addr,size) \ #define ROUND_SIZE(addr,size) \
(((UINT32)(size) + ((UINT32)(addr) & page_mask) + page_mask) & ~page_mask) (((UINT32)(size) + ((UINT32)(addr) & page_mask) + page_mask) & ~page_mask)
static void VIRTUAL_DestroyMapping( K32OBJ *obj );
const K32OBJ_OPS MEM_MAPPED_FILE_Ops =
{
VIRTUAL_DestroyMapping /* destroy */
};
#define VIRTUAL_DEBUG_DUMP_VIEW(view) \ #define VIRTUAL_DEBUG_DUMP_VIEW(view) \
if (!TRACE_ON(virtual)); else VIRTUAL_DumpView(view) if (!TRACE_ON(virtual)); else VIRTUAL_DumpView(view)
@ -1064,7 +1056,6 @@ HANDLE32 WINAPI CreateFileMapping32A(
LPCSTR name /* [in] Name of file-mapping object */ ) LPCSTR name /* [in] Name of file-mapping object */ )
{ {
FILE_MAPPING *mapping = NULL; FILE_MAPPING *mapping = NULL;
K32OBJ *file;
struct create_mapping_request req; struct create_mapping_request req;
struct create_mapping_reply reply = { -1 }; struct create_mapping_reply reply = { -1 };
HANDLE32 handle; HANDLE32 handle;
@ -1125,7 +1116,6 @@ HANDLE32 WINAPI CreateFileMapping32A(
SetLastError( ERROR_INVALID_PARAMETER ); SetLastError( ERROR_INVALID_PARAMETER );
return 0; return 0;
} }
file = NULL;
if (name) if (name)
{ {
CHAR buf[260]; CHAR buf[260];
@ -1158,8 +1148,8 @@ HANDLE32 WINAPI CreateFileMapping32A(
((protect & 0xff) == PAGE_EXECUTE_WRITECOPY)) ((protect & 0xff) == PAGE_EXECUTE_WRITECOPY))
access |= GENERIC_WRITE; access |= GENERIC_WRITE;
if (!(file = HANDLE_GetObjPtr( PROCESS_Current(), hFile, K32OBJ_FILE, if ((req.handle = HANDLE_GetServerHandle( PROCESS_Current(), hFile,
access, &req.handle ))) goto error; K32OBJ_FILE, access )) == -1) goto error;
if (!GetFileInformationByHandle( hFile, &info )) goto error; if (!GetFileInformationByHandle( hFile, &info )) goto error;
if (!size_high && !size_low) if (!size_high && !size_low)
{ {
@ -1194,7 +1184,6 @@ HANDLE32 WINAPI CreateFileMapping32A(
if (!(mapping = HeapAlloc( SystemHeap, 0, sizeof(*mapping) ))) goto error; if (!(mapping = HeapAlloc( SystemHeap, 0, sizeof(*mapping) ))) goto error;
mapping->header.type = K32OBJ_MEM_MAPPED_FILE; mapping->header.type = K32OBJ_MEM_MAPPED_FILE;
mapping->header.refcount = 1; mapping->header.refcount = 1;
mapping->file = file;
if (!K32OBJ_AddName( &mapping->header, name )) handle = 0; if (!K32OBJ_AddName( &mapping->header, name )) handle = 0;
else handle = HANDLE_Alloc( PROCESS_Current(), &mapping->header, else handle = HANDLE_Alloc( PROCESS_Current(), &mapping->header,
@ -1205,7 +1194,6 @@ HANDLE32 WINAPI CreateFileMapping32A(
error: error:
if (reply.handle != -1) CLIENT_CloseHandle( reply.handle ); if (reply.handle != -1) CLIENT_CloseHandle( reply.handle );
if (file) K32OBJ_DecCount( file );
if (mapping) HeapFree( SystemHeap, 0, mapping ); if (mapping) HeapFree( SystemHeap, 0, mapping );
return 0; return 0;
} }
@ -1282,22 +1270,6 @@ HANDLE32 WINAPI OpenFileMapping32W( DWORD access, BOOL32 inherit, LPCWSTR name)
} }
/***********************************************************************
* VIRTUAL_DestroyMapping
*
* Destroy a FILE_MAPPING object.
*/
static void VIRTUAL_DestroyMapping( K32OBJ *ptr )
{
FILE_MAPPING *mapping = (FILE_MAPPING *)ptr;
assert( ptr->type == K32OBJ_MEM_MAPPED_FILE );
if (mapping->file) K32OBJ_DecCount( mapping->file );
ptr->type = K32OBJ_UNKNOWN;
HeapFree( SystemHeap, 0, mapping );
}
/*********************************************************************** /***********************************************************************
* MapViewOfFile (KERNEL32.385) * MapViewOfFile (KERNEL32.385)
* Maps a view of a file into the address space * Maps a view of a file into the address space

View File

@ -15,7 +15,6 @@
/* The declarations are here to avoid including a lot of unnecessary files */ /* The declarations are here to avoid including a lot of unnecessary files */
extern const K32OBJ_OPS PROCESS_Ops; extern const K32OBJ_OPS PROCESS_Ops;
extern const K32OBJ_OPS THREAD_Ops; extern const K32OBJ_OPS THREAD_Ops;
extern const K32OBJ_OPS MEM_MAPPED_FILE_Ops;
static const K32OBJ_OPS K32OBJ_NullOps = static const K32OBJ_OPS K32OBJ_NullOps =
{ {
@ -43,7 +42,7 @@ const K32OBJ_OPS * const K32OBJ_Ops[K32OBJ_NBOBJECTS] =
&K32OBJ_DefaultOps, /* K32OBJ_CHANGE */ &K32OBJ_DefaultOps, /* K32OBJ_CHANGE */
&K32OBJ_DefaultOps, /* K32OBJ_CONSOLE */ &K32OBJ_DefaultOps, /* K32OBJ_CONSOLE */
&K32OBJ_NullOps, /* K32OBJ_SCREEN_BUFFER */ &K32OBJ_NullOps, /* K32OBJ_SCREEN_BUFFER */
&MEM_MAPPED_FILE_Ops, /* K32OBJ_MEM_MAPPED_FILE */ &K32OBJ_DefaultOps, /* K32OBJ_MEM_MAPPED_FILE */
&K32OBJ_NullOps, /* K32OBJ_SERIAL */ &K32OBJ_NullOps, /* K32OBJ_SERIAL */
&K32OBJ_NullOps, /* K32OBJ_DEVICE_IOCTL */ &K32OBJ_NullOps, /* K32OBJ_DEVICE_IOCTL */
&K32OBJ_DefaultOps, /* K32OBJ_PIPE */ &K32OBJ_DefaultOps, /* K32OBJ_PIPE */