Changeset 3259 for trunk/src/kernel32/virtual.cpp
- Timestamp:
- Mar 28, 2000, 7:11:50 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/virtual.cpp
r2802 r3259 1 /* $Id: virtual.cpp,v 1.2 8 2000-02-16 14:22:46sandervl Exp $ */1 /* $Id: virtual.cpp,v 1.29 2000-03-28 17:11:50 sandervl Exp $ */ 2 2 3 3 /* … … 553 553 LPVOID lpBase; 554 554 555 if(pmbiBuffer == NULL || cbLength == 0) // check parameters 556 { 557 return 0; // nothing to return 558 } 555 if(pmbiBuffer == NULL || cbLength != sizeof(MEMORY_BASIC_INFORMATION)) // check parameters 556 { 557 SetLastError(ERROR_INVALID_PARAMETER); 558 return 0; // nothing to return 559 } 560 SetLastError(ERROR_SUCCESS); 559 561 560 562 // determine exact page range 561 563 lpBase = (LPVOID)((ULONG)lpvAddress & 0xFFFFF000); 562 cbRangeSize = cbLength & ~0x00000FFF; // assuming intel page sizes :) 563 if(cbLength & 0x00000FFF) 564 cbRangeSize += PAGE_SIZE; 564 cbRangeSize = -1; 565 565 566 566 rc = OSLibDosQueryMem(lpBase, … … 569 569 if(rc) 570 570 { 571 dprintf(("VirtualQuery - OSLibDosQueryMem %x %x returned %d\n", 572 lpBase, 573 cbLength, 574 rc)); 575 return 0; 571 dprintf(("VirtualQuery - OSLibDosQueryMem %x %x returned %d\n", 572 lpBase, cbLength, rc)); 573 SetLastError(ERROR_INVALID_PARAMETER); 574 return 0; 576 575 } 577 576 … … 607 606 608 607 if(!(dAttr & PAG_SHARED)) 609 pmbiBuffer->Type = MEM_PRIVATE;608 pmbiBuffer->Type = MEM_PRIVATE; 610 609 611 610 //TODO: This is not correct: AllocationProtect should contain the protection 612 611 // flags used in the initial call to VirtualAlloc 613 612 pmbiBuffer->AllocationProtect = pmbiBuffer->Protect; 614 if(dAttr & PAG_BASE) 615 pmbiBuffer->AllocationBase = lpBase; 613 if(dAttr & PAG_BASE) { 614 pmbiBuffer->AllocationBase = lpBase; 615 } 616 616 else 617 617 { 618 while(lpBase > 0) 619 { 620 rc = OSLibDosQueryMem(lpBase, &cbRangeSize, &dAttr); 621 if(rc) 622 { 623 dprintf(("VirtualQuery - OSLibDosQueryMem %x %x returned %d\n", 624 lpBase, 625 cbLength, 626 rc)); 627 break; 628 } 629 if(dAttr & PAG_BASE) 630 { 631 pmbiBuffer->AllocationBase = lpBase; 632 break; 633 } 634 lpBase = (LPVOID)((ULONG)lpBase - PAGE_SIZE); 635 } 618 while(lpBase > 0) 619 { 620 rc = OSLibDosQueryMem(lpBase, &cbRangeSize, &dAttr); 621 if(rc) { 622 dprintf(("VirtualQuery - OSLibDosQueryMem %x %x returned %d\n", 623 lpBase, cbLength, rc)); 624 break; 625 } 626 if(dAttr & PAG_BASE) { 627 pmbiBuffer->AllocationBase = lpBase; 628 break; 629 } 630 lpBase = (LPVOID)((ULONG)lpBase - PAGE_SIZE); 631 } 636 632 } 637 633 return sizeof(MEMORY_BASIC_INFORMATION);
Note:
See TracChangeset
for help on using the changeset viewer.