- Timestamp:
- Dec 17, 2000, 12:03:32 AM (25 years ago)
- Location:
- trunk/src/win32k/test
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/win32k/test/fake.c
r4787 r4810 1 /* $Id: fake.c,v 1. 5 2000-12-11 06:53:57bird Exp $1 /* $Id: fake.c,v 1.6 2000-12-16 23:03:31 bird Exp $ 2 2 * 3 3 * Fake stubs for the ldr and kernel functions we imports or overloads. … … 74 74 static CHAR achHeaderBuffer[256]; /* Buffer to read exe header into. */ 75 75 PVOID pheaderbuf = &achHeaderBuffer[0]; 76 77 /* 78 * Mte list pointers. 79 */ 80 PMTE fakemte_h; 81 PMTE fakeglobal_h; 82 PMTE fakeglobal_l; 83 PMTE fakespecific_h; 84 PMTE fakespecific_l; 85 PMTE fakeprogram_h; 86 PMTE fakeprogram_l; 76 87 77 88 … … 120 131 ULONG LDRCALL fakeldrCreateMte(struct e32_exe * pe32, ldrlv_t *plv); 121 132 ULONG LDRCALL fakeldrLoadImports(PMTE pmte); 122 VOID LDRCALL fakeldrUCaseString(PCHAR pachString, USHORT cchString);123 133 ULONG LDRCALL fakeldrMTEValidatePtrs(PSMTE psmte, ULONG ulMaxAddr, ULONG off); 124 134 unsigned short getSlot(void); … … 408 418 * Probably this function will expand a relative path to a full path. 409 419 * @returns NO_ERROR on success. OS/2 error code on error. 410 * @param pszPath Pointer to path to expand. Contains the full path upon return. (?) 411 * This buffer should probably be of CCHMAXPATH length. 420 * The ldr filename buffer will hold the expanded 421 * pathname upon successfull return. 422 * @param pszPath Pointer to path to expand. (?) 412 423 * @status completely implemented. 413 424 */ … … 1802 1813 1803 1814 1815 /** 1816 * Checks if the internal name (first name in the resident nametable) matches 1817 * the filename. 1818 * @returns NO_ERROR on success (the name matched). 1819 * ERROR_INVALID_NAME if mismatch. 1820 * @param pMTE Pointer to the MTE of the module to check.<br> 1821 * Assumes! that the filename for this module is present in ldrpFileNameBuf. 1822 */ 1823 ULONG LDRCALL fakeldrCheckInternalName(PMTE pMTE) 1824 { 1825 PCHAR pachName; /* Pointer to the name part of pachFilename. */ 1826 int cchName; /* Length of the name part of pachFilename. 1827 * Includes extention if extention is not .DLL. 1828 * this is the length relative to pachName used to match the internal name. */ 1829 PCHAR pachExt; /* Pointer to the extention part of pachFilename. (not dot!) */ 1830 int cchExt; /* Length of the extention part of pachFilename. (not dot!) */ 1831 1832 1833 /* Return successfully if not library module. */ 1834 if (!(pMTE->mte_flags1 & LIBRARYMOD)) 1835 return NO_ERROR; 1836 1837 /* Uppercase and parse filename in ldrpFileNameBuf */ 1838 cchName = (int)fakeldrGetFileName(ldrpFileNameBuf, (PCHAR*)SSToDS(&pachName), (PCHAR*)SSToDS(&pachExt)); 1839 cchExt = (pachExt) ? strlen(pachExt) : 0; 1840 ldrUCaseString(pachName, cchName + cchExt + 1); 1841 1842 /* Compare the internal name with the filename and return accordingly. */ 1843 return ( cchName <= 8 1844 && !memcmp(pMTE->mte_modname, pachName, cchName) 1845 && (cchName == 8 || pMTE->mte_modname[cchName] == '\0') 1846 ) 1847 ? NO_ERROR 1848 : ERROR_INVALID_NAME; 1849 } 1850 1851 1852 /** 1853 * Translates a relative filename to a full qualified filename. 1854 * @returns NO_ERROR on success. 1855 * Errorcode on error. 1856 * @param pszFilename Pointer to nullterminated filename. 1857 */ 1858 ULONG LDRCALL fakeldrTransPath(PSZ pszFilename) 1859 { 1860 return fakeIOSftTransPath(pszFilename); 1861 } 1862 1863 1864 /** 1865 * Parses a filename to find the name and extention. 1866 * @returns Length of the filename without the extention. 1867 * @param pachFilename Pointer to filename to parse - must have path! 1868 * @param ppachName Pointer to pointer which should hold the name pointer upon successfull return. 1869 * @param ppachExt Pointer to pointer which should hold the extention pointer upon successfull return. 1870 */ 1871 ULONG LDRCALL fakeldrGetFileName(PSZ pszFilename, PCHAR *ppchName, PCHAR *ppchExt) 1872 { 1873 int cchName; 1874 PSZ pchName; 1875 PSZ pchExt = NULL; 1876 1877 while (*pszFilename) 1878 { 1879 if (*pszFilename == '\\' || *pszFilename == '/') 1880 pchName = pszFilename + 1; 1881 else if (*pszFilename == '.') 1882 pchExt = pszFilename + 1; 1883 pszFilename++; 1884 } 1885 1886 cchName = (pchExt <= pchName) ? strlen(pchName) : pchExt - pchName - 1; 1887 *ppchExt = pchExt; 1888 *ppchName = pchName; 1889 1890 return cchName; 1891 } 1892 1804 1893 1805 1894 /** … … 1812 1901 * @remark This is probably written in assembly and does DBCS checks... 1813 1902 */ 1814 VOID LDRCALL fakeldrUCaseString(PCHAR pachString, USHORTcchString)1903 VOID LDRCALL fakeldrUCaseString(PCHAR pachString, unsigned cchString) 1815 1904 { 1816 1905 printf("fakeldrUCaseString: pachString = %.*s, cchString = %#8x\n", -
trunk/src/win32k/test/win32ktst.c
r4787 r4810 1 /* $Id: win32ktst.c,v 1. 4 2000-12-11 06:53:57bird Exp $1 /* $Id: win32ktst.c,v 1.5 2000-12-16 23:03:32 bird Exp $ 2 2 * 3 3 * Win32k test module. … … 578 578 case 2: rc = TestCase2(); break; 579 579 case 3: rc = TestCase3(); break; 580 case 4: rc = TestCase4(); break; 581 case 5: rc = TestCase5(); break; 580 582 581 583 default: … … 772 774 rc = TestCaseExeLoad2(); 773 775 } 776 } 777 else 778 printf("!failed!\n"); 779 } 780 else 781 printf("!failed!\n"); 782 783 return rc; 784 } 785 786 787 /** 788 * Test case 4. 789 * Checks that all parameters are read correctly (3). 790 * 791 * @sketch Create init packet with no arguments. 792 * Initiate elf$ 793 * Create init packet with no arguments. 794 * Initiate win32k$ 795 * @returns 0 on success. 796 * 1 on failure. 797 * @status completely implemented. 798 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 799 */ 800 int TestCase4(void) 801 { 802 int rc = 1; 803 RP32INIT rpinit; 804 char * pszInitArgs = "-P:pe"; 805 806 /* $elf */ 807 initRPInit(SSToDS(&rpinit), pszInitArgs); 808 rc = InitElf(&rpinit); /* no SSToDS! */ 809 printf("InitElf returned status=0x%04x\n", rpinit.rph.Status); 810 if ((rpinit.rph.Status & (STDON | STERR)) == STDON) 811 { 812 /* $win32k */ 813 initRPInit(SSToDS(&rpinit), pszInitArgs); 814 rc = InitWin32k(&rpinit); /* no SSToDS! */ 815 printf("InitWin32k returned status=0x%04x\n", rpinit.rph.Status); 816 if ((rpinit.rph.Status & (STDON | STERR)) == STDON) 817 { 818 struct options opt = DEFAULT_OPTION_ASSIGMENTS; 819 opt.fPE = FLAGS_PE_PE; 820 821 rc = CompareOptions(SSToDS(&opt)); 822 /* 823 if (rc == NO_ERROR) 824 { 825 rc = TestCaseExeLoad2(); 826 } 827 */ 828 } 829 else 830 printf("!failed!\n"); 831 } 832 else 833 printf("!failed!\n"); 834 835 return rc; 836 } 837 838 839 /** 840 * Test case 5. 841 * Checks that all parameters are read correctly (3). 842 * 843 * @sketch Create init packet with no arguments. 844 * Initiate elf$ 845 * Create init packet with no arguments. 846 * Initiate win32k$ 847 * @returns 0 on success. 848 * 1 on failure. 849 * @status completely implemented. 850 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 851 */ 852 int TestCase5(void) 853 { 854 int rc = 1; 855 RP32INIT rpinit; 856 char * pszInitArgs = "-Pe:pe"; 857 858 /* $elf */ 859 initRPInit(SSToDS(&rpinit), pszInitArgs); 860 rc = InitElf(&rpinit); /* no SSToDS! */ 861 printf("InitElf returned status=0x%04x\n", rpinit.rph.Status); 862 if ((rpinit.rph.Status & (STDON | STERR)) == STDON) 863 { 864 /* $win32k */ 865 initRPInit(SSToDS(&rpinit), pszInitArgs); 866 rc = InitWin32k(&rpinit); /* no SSToDS! */ 867 printf("InitWin32k returned status=0x%04x\n", rpinit.rph.Status); 868 if ((rpinit.rph.Status & (STDON | STERR)) == STDON) 869 { 870 struct options opt = DEFAULT_OPTION_ASSIGMENTS; 871 opt.fPE = FLAGS_PE_PE; 872 873 rc = CompareOptions(SSToDS(&opt)); 874 /* 875 if (rc == NO_ERROR) 876 { 877 rc = TestCaseExeLoad2(); 878 } 879 */ 774 880 } 775 881 else
Note:
See TracChangeset
for help on using the changeset viewer.