Changeset 7117 for trunk/src/win32k/kKrnlLib/tools/libconv.c
- Timestamp:
- Oct 19, 2001, 2:07:30 AM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/win32k/kKrnlLib/tools/libconv.c
r6628 r7117 1 /* $Id: libconv.c,v 1. 1 2001-09-02 04:35:58bird Exp $1 /* $Id: libconv.c,v 1.2 2001-10-19 00:07:30 bird Exp $ 2 2 * 3 3 * Very simple OMF/LIB dumper. … … 9 9 */ 10 10 11 /******************************************************************************* 12 * Defined Constants And Macros * 13 *******************************************************************************/ 14 /** 15 * Upcases a char. 16 */ 17 #define upcase(ch) ((ch) >= 'a' && (ch) <= 'z' ? (char)((ch) - ('a' - 'A')) : (ch)) 18 19 20 /** 21 * Access macro for reading index value. 22 * @return index value. 0 - 32768. 23 * @param pch Pointer to the first byte of the index. 24 */ 25 #define INDEX_VALUE(pch) ( *(char*)(pch) & 0x80 \ 26 ? (*(char *)(pch) & 0x7f) * 0x100 + *((char*)(pch)+1) \ 27 : *((char*)(pch)) ) 28 29 /** 30 * Access macro for determin the size of an index. 31 * @return index size in bytes. 1 or 2. 32 * @param pch Pointer to the first byte of the index. 33 */ 34 #define INDEX_SIZE(pch) ( *(char*)(pch) & 0x80 ? 2 : 1 ) 35 36 37 /** 38 * Get a byte at a given offset. 39 * @return byte at given offset. 40 * @param pch Pointer to address relativ to. 41 * @param off Byte offset from pch. 42 */ 43 #define OMF_BYTE(pch, off) ( *((char*)(pch) + (int)(off)) ) 44 45 46 /** 47 * Get a word (unsigned short) at a given offset. 48 * @return word (unsigned short) at given offset. 49 * @param pch Pointer to address relativ to. 50 * @param off Byte offset from pch. 51 */ 52 #define OMF_WORD(pch, off) ( *(unsigned short*)((char*)(pch) + (int)(off)) ) 53 54 55 /** 56 * Get a dword (unsigned long) at a given offset. 57 * @return dword (unsigned long) at given offset. 58 * @param pch Pointer to address relativ to. 59 * @param off Byte offset from pch. 60 */ 61 #define OMF_DWORD(pch, off) ( *(unsigned long*)((char*)(pch) + (int)(off)) ) 62 11 63 12 64 /*@Header*********************************************************************** … … 20 72 #include "include\omf.h" 21 73 22 int f CodeToCode16= 0;74 int fUpcase = 0; 23 75 int fRemoveExtra = 0; 24 76 … … 36 88 int argi = 1; 37 89 38 if (argc == 4)90 if (argc >= 4) 39 91 { 40 92 argi = 2; … … 61 113 psz = strrchr(pszFilename, '\\'); 62 114 if (psz) 63 f CodeToCode16= stricmp(psz, "\\dhcalls.lib") == 0;115 fUpcase = stricmp(psz, "\\dhcalls.lib") == 0; 64 116 65 117 phFile = fopen(pszFilename, "rb"); … … 186 238 cbRecord = *((unsigned short*)((int)pvRecord+1)) + 3; 187 239 *((char*)pvRecord + cbRecord - 1) = 0; 240 if (fUpcase) 241 { 242 char *pch = (char*)pvRecord; 243 char *pch1, *pch2, *pchEnd; 244 pch1 = pch + 3 + INDEX_SIZE(pch + 3); 245 pch2 = pch1 + INDEX_SIZE(pch1); 246 if (!*pch1) 247 pch2 += 2; 248 249 for (pchEnd = pch + pch[1]; pch2 + 1 < pchEnd; ) 250 { 251 int i; 252 for (i = 1; i <= *pch2; i++) 253 pch2[i] = upcase(pch2[i]); 254 pch2 += *pch2 + 1 + (pch[0] & 0x1 ? 4 : 2); 255 pch2 += INDEX_SIZE(pch2); 256 } 257 } 188 258 break; 189 259 }
Note:
See TracChangeset
for help on using the changeset viewer.