Changeset 21435 for trunk/src/kernel32
- Timestamp:
- Aug 30, 2010, 2:05:13 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/heap.cpp
r21361 r21435 37 37 { 38 38 HANDLE _processheap; 39 39 40 40 //SvL: Only one process heap per process 41 41 OS2ProcessHeap = new OS2Heap(HEAP_GENERATE_EXCEPTIONS, 0x4000, 0); … … 44 44 return(NULL); 45 45 _processheap = OS2ProcessHeap->getHeapHandle(); 46 46 47 47 return _processheap; 48 48 } … … 70 70 else \ 71 71 curheap = OS2Heap::find(hHeap); \ 72 73 74 75 //****************************************************************************** 76 //****************************************************************************** 77 LPVOID WIN32API HeapAlloc(HANDLE hHeap, 72 73 74 75 //****************************************************************************** 76 //****************************************************************************** 77 LPVOID WIN32API HeapAlloc(HANDLE hHeap, 78 78 DWORD dwFlags, 79 79 DWORD dwBytes) … … 91 91 //****************************************************************************** 92 92 //****************************************************************************** 93 LPVOID HeapReAlloc(HANDLE hHeap, 93 LPVOID HeapReAlloc(HANDLE hHeap, 94 94 DWORD dwFlags, 95 LPVOID lpMem, 95 LPVOID lpMem, 96 96 DWORD dwBytes) 97 97 { … … 110 110 //****************************************************************************** 111 111 //****************************************************************************** 112 BOOL WIN32API HeapFree(HANDLE hHeap, 112 BOOL WIN32API HeapFree(HANDLE hHeap, 113 113 DWORD dwFlags, 114 114 LPVOID lpMem) … … 121 121 122 122 BOOL fResult = curheap->Free(dwFlags, lpMem); 123 123 124 124 /* 2002-04-25 PH 125 125 * Apparently, Win2k does not do this. It does not touch last error, 126 126 * it does not even return FALSE but just anything != TRUE. 127 127 * 128 128 129 129 if (fResult == FALSE) 130 130 SetLastError(ERROR_INVALID_HANDLE); 131 131 132 132 */ 133 133 134 134 return fResult; 135 135 } 136 136 //****************************************************************************** 137 137 //****************************************************************************** 138 HANDLE WIN32API HeapCreate(DWORD flOptions, DWORD dwInitialSize, 138 HANDLE WIN32API HeapCreate(DWORD flOptions, DWORD dwInitialSize, 139 139 DWORD dwMaximumSize) 140 140 { … … 219 219 BOOL WIN32API HeapWalk(HANDLE hHeap, LPVOID lpEntry) 220 220 { 221 dprintf(("KERNEL32: HeapWalk - stub (TRUE)\n")); 222 return(TRUE); 221 dprintf(("KERNEL32: HeapWalk - stub (FALSE, ERROR_CALL_NOT_IMPLEMENTED)\n")); 222 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 223 return(FALSE); 223 224 } 224 225 //****************************************************************************** … … 232 233 * Win32 Global heap functions (GlobalXXX). 233 234 * These functions included in Win32 for compatibility with 16 bit Windows 234 * Especially the moveable blocks and handles are oldish. 235 * Especially the moveable blocks and handles are oldish. 235 236 * But the ability to directly allocate memory with GPTR and LPTR is widely 236 237 * used. 237 238 * 238 239 * The handle stuff looks horrible, but it's implemented almost like Win95 239 * does it. 240 * does it. 240 241 * 241 242 */ … … 280 281 else 281 282 hpflags=0; 282 283 283 284 if((flags & GMEM_MOVEABLE)==0) /* POINTER */ 284 285 { … … 308 309 pintern->Flags=flags>>8; 309 310 pintern->LockCount=0; 310 311 311 312 /* HeapUnlock(heap); */ 312 313 313 314 return INTERN_TO_HANDLE(pintern); 314 315 } … … 340 341 341 342 /* HeapLock(GETPROCESSHEAP); */ 342 343 343 344 pintern=HANDLE_TO_INTERN(hmem); 344 345 if(pintern->Magic==MAGIC_GLOBAL_USED) … … 384 385 /* HeapLock(GETPROCESSHEAP); */ 385 386 pintern=HANDLE_TO_INTERN(hmem); 386 387 387 388 if(pintern->Magic==MAGIC_GLOBAL_USED) 388 389 { … … 616 617 PGLOBAL32_INTERN pintern; 617 618 HGLOBAL hreturned = 0; 618 619 619 620 // 2001-10-17 PH 620 621 // Note: we do have a *HANDLE* here still ... … … 630 631 } 631 632 #endif 632 633 633 634 if(ISPOINTER(hmem)) /* POINTER */ 634 635 { … … 642 643 /* HeapLock(heap); */ 643 644 pintern=HANDLE_TO_INTERN(hmem); 644 645 645 646 if(pintern->Magic==MAGIC_GLOBAL_USED) 646 { 647 { 647 648 648 649 /* WIN98 does not make this test. That is you can free a */ … … 656 657 if(!HeapFree(GETPROCESSHEAP, 0, pintern)) 657 658 hreturned=hmem; 658 } 659 } 659 660 else 660 661 { … … 663 664 hreturned = hmem; 664 665 } 665 666 666 667 /* HeapUnlock(heap); */ 667 668 } 668 669 669 670 return hreturned; 670 671 } … … 682 683 PGLOBAL32_INTERN pintern; 683 684 684 if(ISPOINTER(hmem)) 685 if(ISPOINTER(hmem)) 685 686 { 686 687 retval=HeapSize(GETPROCESSHEAP, 0, (LPVOID) hmem); … … 690 691 /* HeapLock(heap); */ 691 692 pintern=HANDLE_TO_INTERN(hmem); 692 693 693 694 if(pintern->Magic==MAGIC_GLOBAL_USED) 694 695 { … … 775 776 pintern=HANDLE_TO_INTERN(hmem); 776 777 if(pintern->Magic==MAGIC_GLOBAL_USED) 777 { 778 { 778 779 retval=pintern->LockCount + (pintern->Flags<<8); 779 780 if(pintern->Pointer==0)
Note:
See TracChangeset
for help on using the changeset viewer.