Changeset 5909 for trunk/src/kernel32/winimagepeldr.cpp
- Timestamp:
- Jun 5, 2001, 6:46:01 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/winimagepeldr.cpp
r5859 r5909 1 /* $Id: winimagepeldr.cpp,v 1.8 0 2001-06-01 08:10:48 sandervlExp $ */1 /* $Id: winimagepeldr.cpp,v 1.81 2001-06-05 16:44:46 phaller Exp $ */ 2 2 3 3 /* … … 1887 1887 1888 1888 curexport = ordexports; 1889 1889 1890 #if 1 1891 /* accelerated resolving of ordinal exports 1892 * is based on the assumption the ordinal export 1893 * table is always sorted ascending. 1894 * 1895 * When the step size is too small, we continue 1896 * with the linear search. 1897 */ 1898 1899 // start in the middle of the tree 1900 i = nrOrdExports >> 1; 1901 int iStep = i; 1902 1903 for(;;) 1904 { 1905 int iThisExport = curexport[i].ordinal; 1906 1907 iStep >>= 1; // next step will be narrower 1908 1909 if (iThisExport < ordinal) 1910 i += iStep; // move farther down the list 1911 else 1912 if (iThisExport == ordinal) // found the export? 1913 return curexport[i].virtaddr; 1914 else 1915 i -= iStep; // move farther up the list 1916 1917 // if we're in the direct neighbourhood search linearly 1918 if (iStep <= 1) 1919 { 1920 // decide if we're to search backward or forward 1921 if (ordinal > curexport[i].ordinal) 1922 { 1923 // As a certain number of exports are 0 at the end 1924 // of the array, this case will hit fairly often. 1925 // the last comparison will send the loop off into the 1926 // wrong direction! 1927 if (curexport[i].ordinal == 0) 1928 { 1929 // start over with plain dump search 1930 for(i = 0; i < nrOrdExports; i++) 1931 { 1932 if(curexport[i].ordinal == ordinal) 1933 return(curexport[i].virtaddr); 1934 } 1935 break; // not found yet! 1936 } 1937 1938 for (;i<nrOrdExports;i++) // scan forward 1939 { 1940 iThisExport = curexport[i].ordinal; 1941 if(iThisExport == ordinal) 1942 return(curexport[i].virtaddr); 1943 else 1944 if (iThisExport > ordinal) 1945 { 1946 // Oops, cannot find the ordinal in the sorted list 1947 break; 1948 } 1949 } 1950 } 1951 else 1952 { 1953 for (;i>=0;i--) // scan backward 1954 { 1955 iThisExport = curexport[i].ordinal; 1956 if(curexport[i].ordinal == ordinal) 1957 return(curexport[i].virtaddr); 1958 else 1959 if (iThisExport < ordinal) 1960 // Oops, cannot find the ordinal in the sorted list 1961 break; 1962 } 1963 } 1964 1965 // not found yet. 1966 break; 1967 } 1968 } 1969 #endif 1970 1971 1972 #if 0 1890 1973 i = 0; 1891 1974 if(nrOrdExports > 1000) { … … 1927 2010 if(i >= nrOrdExports) i -= 10; 1928 2011 } 2012 #endif 2013 2014 #if 0 1929 2015 for(i;i<nrOrdExports;i++) { 1930 2016 if(curexport[i].ordinal == ordinal) 1931 2017 return(curexport[i].virtaddr); 1932 2018 } 2019 #endif 1933 2020 1934 2021 //Name exports also contain an ordinal, so check this
Note:
See TracChangeset
for help on using the changeset viewer.