Ignore:
Timestamp:
Aug 24, 1999, 2:23:54 PM (26 years ago)
Author:
sandervl
Message:

VirtualQuery implemented + preliminary memory mapped code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/virtual.cpp

    r607 r657  
    1 /* $Id: virtual.cpp,v 1.1 1999-08-21 16:30:31 sandervl Exp $ */
     1/* $Id: virtual.cpp,v 1.2 1999-08-24 12:23:25 sandervl Exp $ */
    22
    33/*
    44 * Win32 virtual memory functions
    55 *
    6  * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl) (OS/2 Port)
    7  *
    8  * NOTE: Quick 'n dirty implementation (read entire file in memory)
    9  *       Not tested, nor complete (write mapping & protection)
    10  *
    11  * Based on Wine code (memory\virtual.c):
     6 * Copyright 1999 Sander van Leeuwen (sandervl@xs4all.nl)
     7 *
     8 * Parts (VIRTUAL_MapFileA/W) based on Wine code (memory\virtual.c):
    129 *
    1310 * Copyright 1997 Alexandre Julliard
     
    2219#include <win\virtual.h>
    2320#include <heapstring.h>
    24 
     21#include "mmap.h"
    2522
    2623/***********************************************************************
     
    4340 HANDLE dupHandle;
    4441
    45      if(DuplicateHandle(GetCurrentProcess(), hFile, GetCurrentProcess(),
     42   if((hFile == -1 && size_low == 0) || size_high ||
     43       protect & (PAGE_READONLY|PAGE_READWRITE|PAGE_WRITECOPY|SEC_COMMIT|SEC_IMAGE|SEC_RESERVE|SEC_NOCACHE) ||
     44       ((protect & SEC_COMMIT) && (protect & SEC_RESERVE)))
     45   {
     46
     47        dprintf(("CreateFileMappingA: invalid parameter (combination)!"));
     48        SetLastError(ERROR_INVALID_PARAMETER);
     49        return 0;       
     50   }
     51   if(DuplicateHandle(GetCurrentProcess(), hFile, GetCurrentProcess(),
    4652                        &dupHandle, 0, FALSE, DUPLICATE_SAME_ACCESS) == FALSE)
    47      {
    48                 dprintf(("CreateFileMappingA: DuplicateHandle failed!"));
    49                 return 0;
    50      }
    51      return     dupHandle;
     53   {
     54        dprintf(("CreateFileMappingA: DuplicateHandle failed!"));
     55        return 0;
     56   }
     57   return dupHandle;
    5258}
    5359
     
    239245    LPVOID ptr = NULL;
    240246
    241     hFile = CreateFileA( name, GENERIC_READ, FILE_SHARE_READ, NULL,
    242                            OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, 0);
     247    hFile = CreateFileA(name, GENERIC_READ, FILE_SHARE_READ, NULL,
     248                        OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, 0);
    243249    if (hFile != INVALID_HANDLE_VALUE)
    244250    {
Note: See TracChangeset for help on using the changeset viewer.