Changeset 1432 for trunk/src/kernel32/virtual.cpp
- Timestamp:
- Oct 25, 1999, 12:53:25 AM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/virtual.cpp
r1395 r1432 1 /* $Id: virtual.cpp,v 1.2 0 1999-10-21 19:24:23sandervl Exp $ */1 /* $Id: virtual.cpp,v 1.21 1999-10-24 22:51:22 sandervl Exp $ */ 2 2 3 3 /* … … 676 676 } 677 677 } 678 679 //****************************************************************************** 680 //SvL: Private api 681 //****************************************************************************** 682 LPVOID VirtualAllocShared(DWORD cbSize, DWORD fdwAllocationType, 683 DWORD fdwProtect, LPSTR name) 684 { 685 LPVOID Address; 686 ULONG flag = 0, base; 687 DWORD rc; 688 689 dprintf(("VirtualAllocShared: %x %x %x %s", cbSize, fdwAllocationType, fdwProtect, name)); 690 691 if (cbSize > 0x7fc00000) /* 2Gb - 4Mb */ 692 { 693 dprintf(("VirtualAllocShared: size too large")); 694 SetLastError( ERROR_OUTOFMEMORY ); 695 return NULL; 696 } 697 698 if (!(fdwAllocationType & (MEM_COMMIT | MEM_RESERVE)) || 699 (fdwAllocationType & ~(MEM_COMMIT | MEM_RESERVE))) 700 { 701 dprintf(("VirtualAllocShared: Invalid parameter")); 702 SetLastError( ERROR_INVALID_PARAMETER ); 703 return NULL; 704 } 705 706 if(fdwAllocationType & MEM_COMMIT) 707 { 708 dprintf(("VirtualAllocShared: commit\n")); 709 flag = PAG_COMMIT; 710 } 711 712 if(fdwProtect & PAGE_READONLY) flag |= PAG_READ; 713 if(fdwProtect & PAGE_NOACCESS) flag |= PAG_READ; //can't do this in OS/2 714 if(fdwProtect & PAGE_READWRITE) flag |= (PAG_READ | PAG_WRITE); 715 if(fdwProtect & PAGE_WRITECOPY) flag |= (PAG_READ | PAG_WRITE); 716 717 if(fdwProtect & PAGE_EXECUTE_READWRITE) flag |= (PAG_EXECUTE | PAG_WRITE | PAG_READ); 718 if(fdwProtect & PAGE_EXECUTE_READ) flag |= (PAG_EXECUTE | PAG_READ); 719 if(fdwProtect & PAGE_EXECUTE) flag |= PAG_EXECUTE; 720 721 if(fdwProtect & PAGE_GUARD) { 722 dprintf(("ERROR: PAGE_GUARD bit set for VirtualAllocShared -> we don't support this right now!")); 723 flag |= PAG_GUARD; 724 } 725 726 //just do this if other options are used 727 if(!(flag & (PAG_READ | PAG_WRITE | PAG_EXECUTE)) || flag == 0) 728 { 729 dprintf(("VirtualAllocShared: Unknown protection flags, default to read/write")); 730 flag |= PAG_READ | PAG_WRITE; 731 } 732 733 rc = OSLibDosAllocSharedMem(&Address, cbSize, flag, name); 734 735 if(rc) 736 { 737 dprintf(("DosAllocSharedMem returned %d\n", rc)); 738 SetLastError( ERROR_OUTOFMEMORY ); 739 return(NULL); 740 } 741 742 dprintf(("VirtualAllocShared returned %X\n", Address)); 743 return(Address); 744 }
Note:
See TracChangeset
for help on using the changeset viewer.