Changeset 8918 for trunk/src/kernel32/winimagepeldr.cpp
- Timestamp:
- Jul 26, 2002, 12:46:56 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/winimagepeldr.cpp
r8914 r8918 1 /* $Id: winimagepeldr.cpp,v 1.10 0 2002-07-24 11:29:23sandervl Exp $ */1 /* $Id: winimagepeldr.cpp,v 1.101 2002-07-26 10:46:56 sandervl Exp $ */ 2 2 3 3 /* … … 743 743 ULONG ulNewPos, ulRead, orgVirtAddress = virtAddress; 744 744 APIRET rc; 745 BOOL fCriticalSection = FALSE; 745 746 746 747 dprintf((LOG, "Win32PeLdrImage::commitPage %x %d %d", virtAddress, fWriteAccess, fPageCmd)); … … 796 797 return TRUE; 797 798 } 799 rc = DosEnterCritSec(); 800 if(rc) { 801 dprintf((LOG, "DosEnterCritSec failed with rc %d", rc)); 802 goto fail; 803 } 804 //tell fail handler to call DosExitCritSec 805 fCriticalSection = TRUE; 806 798 807 //Check range of pages with the same attributes starting at virtAddress 799 808 //(some pages might already have been loaded) … … 802 811 if(rc) { 803 812 dprintf((LOG, "Win32PeLdrImage::commitPage: DosQueryMem for %x returned %d", virtAddress, rc)); 804 return FALSE;813 goto fail; 805 814 } 806 815 if(attr & PAG_COMMIT) { 807 816 dprintf((LOG, "Win32PeLdrImage::commitPage: Memory at 0x%x already committed!", virtAddress)); 808 return FALSE;817 goto fail; 809 818 } 810 819 … … 824 833 825 834 if(size && fileoffset != -1) { 826 rc = DosEnterCritSec();827 if(rc) {828 dprintf((LOG, "DosEnterCritSec failed with rc %d", rc));829 goto fail;830 }831 835 rc = DosSetMem((PVOID)virtAddress, sectionsize, PAG_READ|PAG_WRITE|PAG_COMMIT); 832 836 if(rc) { 833 DosExitCritSec();834 837 dprintf((LOG, "Win32PeLdrImage::commitPage: DosSetMem failed (%d)!", rc)); 835 838 goto fail; … … 837 840 838 841 if(DosSetFilePtr(hFile, ulPEOffset+fileoffset, FILE_BEGIN, &ulNewPos) == -1) { 839 DosExitCritSec();840 842 dprintf((LOG, "Win32PeLdrImage::commitPage: DosSetFilePtr failed for 0x%x!", fileoffset)); 841 843 goto fail; … … 850 852 #endif 851 853 if(rc) { 852 DosExitCritSec();853 854 dprintf((LOG, "Win32PeLdrImage::commitPage: DosRead failed for 0x%x %x %x %x (rc=%d)!", virtAddress, size, ulRead, fileoffset, rc)); 854 855 goto fail; 855 856 } 856 857 if(ulRead != size) { 857 DosExitCritSec();858 858 dprintf((LOG, "Win32PeLdrImage::commitPage: DosRead failed to read %x (%x) bytes at %x for 0x%x!", size, ulRead, fileoffset, virtAddress)); 859 859 goto fail; … … 862 862 863 863 rc = DosSetMem((PVOID)virtAddress, sectionsize, protflags); 864 DosExitCritSec();865 864 if(rc) { 866 865 dprintf((LOG, "Win32PeLdrImage::commitPage: DosSetMem failed (%d)!", rc)); … … 869 868 } 870 869 else { 871 rc = DosEnterCritSec();872 if(rc) {873 dprintf((LOG, "DosEnterCritSec failed with rc %d", rc));874 goto fail;875 }876 877 870 rc = DosSetMem((PVOID)virtAddress, sectionsize, PAG_READ|PAG_WRITE|PAG_COMMIT); 878 if(rc) {879 DosExitCritSec();880 dprintf((LOG, "Win32PeLdrImage::commitPage: DosSetMem failed (%d)!", rc));881 goto fail;882 }883 setFixups(virtAddress, sectionsize);884 885 rc = DosSetMem((PVOID)virtAddress, sectionsize, protflags);886 DosExitCritSec();887 871 if(rc) { 888 872 dprintf((LOG, "Win32PeLdrImage::commitPage: DosSetMem failed (%d)!", rc)); 889 873 goto fail; 890 874 } 891 } 875 setFixups(virtAddress, sectionsize); 876 877 rc = DosSetMem((PVOID)virtAddress, sectionsize, protflags); 878 if(rc) { 879 dprintf((LOG, "Win32PeLdrImage::commitPage: DosSetMem failed (%d)!", rc)); 880 goto fail; 881 } 882 } 883 DosExitCritSec(); 892 884 return TRUE; 893 885 894 886 fail: 887 if(fCriticalSection) DosExitCritSec(); 895 888 return FALSE; 896 889 }
Note:
See TracChangeset
for help on using the changeset viewer.