Changeset 3579
- Timestamp:
- Sep 2, 2007, 11:40:41 PM (18 years ago)
- Location:
- trunk/kStuff
- Files:
-
- 3 added
- 1 deleted
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kStuff/include/k/kErrors.h
r3573 r3579 73 73 74 74 /** @name File System and I/O 75 * @{ */ 75 * @{ 76 */ 76 77 /** The base of the file system and I/O status cdoes. */ 77 78 #define KERR_FILE_SYSTEM_AND_IO_BASE (KERR_INPUT_BASE + 7) … … 84 85 85 86 /** @name kDbg Specific 86 * @{ */ 87 * @{ 88 */ 87 89 /** The base of the kDbg specific status codes. */ 88 90 #define KDBG_ERR_BASE (KERR_FILE_SYSTEM_AND_IO_BASE + 2) … … 100 102 101 103 /** @name kRdr Specific 102 * @{ */ 104 * @{ 105 */ 103 106 /** the base of the kRdr specific status codes. */ 104 107 #define KRDR_ERR_BASE (KDBG_ERR_BASE + 5) … … 111 114 /** @} */ 112 115 116 /** @name kLdr Specific 117 * @{ 118 */ 119 #define KLDR_ERR_BASE (KRDR_ERR_BASE + 3) 120 121 /** The image format is unknown. */ 122 #define KLDR_ERR_UNKNOWN_FORMAT (KLDR_ERR_BASE + 0) 123 /** The MZ image format isn't supported by this kLdr build. */ 124 #define KLDR_ERR_MZ_NOT_SUPPORTED (KLDR_ERR_BASE + 1) 125 /** The NE image format isn't supported by this kLdr build. */ 126 #define KLDR_ERR_NE_NOT_SUPPORTED (KLDR_ERR_BASE + 2) 127 /** The LX image format isn't supported by this kLdr build. */ 128 #define KLDR_ERR_LX_NOT_SUPPORTED (KLDR_ERR_BASE + 3) 129 /** The LE image format isn't supported by this kLdr build. */ 130 #define KLDR_ERR_LE_NOT_SUPPORTED (KLDR_ERR_BASE + 4) 131 /** The PE image format isn't supported by this kLdr build. */ 132 #define KLDR_ERR_PE_NOT_SUPPORTED (KLDR_ERR_BASE + 5) 133 /** The ELF image format isn't supported by this kLdr build. */ 134 #define KLDR_ERR_ELF_NOT_SUPPORTED (KLDR_ERR_BASE + 6) 135 /** The mach-o image format isn't supported by this kLdr build. */ 136 #define KLDR_ERR_MACHO_NOT_SUPPORTED (KLDR_ERR_BASE + 7) 137 /** The FAT image format isn't supported by this kLdr build or 138 * a direct open was attempt without going thru the FAT file provider. 139 * FAT images are also known as Universal Binaries. */ 140 #define KLDR_ERR_FAT_NOT_SUPPORTED (KLDR_ERR_BASE + 8) 141 /** The a.out image format isn't supported by this kLdr build. */ 142 #define KLDR_ERR_AOUT_NOT_SUPPORTED (KLDR_ERR_BASE + 9) 143 144 /** The module wasn't loaded dynamically. */ 145 #define KLDR_ERR_NOT_LOADED_DYNAMICALLY (KLDR_ERR_BASE + 10) 146 /** The module wasn't found. */ 147 #define KLDR_ERR_MODULE_NOT_FOUND (KLDR_ERR_BASE + 11) 148 /** A prerequisit module wasn't found. */ 149 #define KLDR_ERR_PREREQUISITE_MODULE_NOT_FOUND (KLDR_ERR_BASE + 12) 150 /** The module is being terminated and can therefore not be loaded. */ 151 #define KLDR_ERR_MODULE_TERMINATING (KLDR_ERR_BASE + 13) 152 /** A prerequisit module is being terminated and can therefore not be loaded. */ 153 #define KLDR_ERR_PREREQUISITE_MODULE_TERMINATING (KLDR_ERR_BASE + 14) 154 /** The module initialization failed. */ 155 #define KLDR_ERR_MODULE_INIT_FAILED (KLDR_ERR_BASE + 15) 156 /** The initialization of a prerequisite module failed. */ 157 #define KLDR_ERR_PREREQUISITE_MODULE_INIT_FAILED (KLDR_ERR_BASE + 16) 158 /** The module has already failed initialization and can't be attempted reloaded until 159 * after we've finished garbage collection. */ 160 #define KLDR_ERR_MODULE_INIT_FAILED_ALREADY (KLDR_ERR_BASE + 17) 161 /** A prerequisite module has already failed initialization and can't be attempted 162 * reloaded until after we've finished garbage collection. */ 163 #define KLDR_ERR_PREREQUISITE_MODULE_INIT_FAILED_ALREADY (KLDR_ERR_BASE + 18) 164 /** Prerequisite recursed too deeply. */ 165 #define KLDR_ERR_PREREQUISITE_RECURSED_TOO_DEEPLY (KLDR_ERR_BASE + 19) 166 /** Failed to allocate the main stack. */ 167 #define KLDR_ERR_MAIN_STACK_ALLOC_FAILED (KLDR_ERR_BASE + 20) 168 /** The specified ARCH+CPU isn't compatible with image. */ 169 #define KLDR_ERR_ARCH_CPU_NOT_COMPATIBLE (KLDR_ERR_BASE + 21) 170 /** Symbol not found. */ 171 #define KLDR_ERR_SYMBOL_NOT_FOUND (KLDR_ERR_BASE + 22) 172 /** A forward symbol was encountered but the caller didn't provide any means to resolve it. */ 173 #define KLDR_ERR_FORWARDER_SYMBOL (KLDR_ERR_BASE + 23) 174 /** Encountered a bad fixup. */ 175 #define KLDR_ERR_BAD_FIXUP (KLDR_ERR_BASE + 24) 176 /** The import ordinal was out of bounds. */ 177 #define KLDR_ERR_IMPORT_ORDINAL_OUT_OF_BOUNDS (KLDR_ERR_BASE + 25) 178 /** A forwarder chain was too long. */ 179 #define KLDR_ERR_TOO_LONG_FORWARDER_CHAIN (KLDR_ERR_BASE + 26) 180 /** The module has no debug info. */ 181 #define KLDR_ERR_NO_DEBUG_INFO (KLDR_ERR_BASE + 27) 182 /** The module is already mapped. 183 * kLdrModMap() can only be called once (without kLdrModUnmap() in between). */ 184 #define KLDR_ERR_ALREADY_MAPPED (KLDR_ERR_BASE + 28) 185 /** The module was not mapped. 186 * kLdrModUnmap() should not called without being preceeded by a kLdrModMap(). */ 187 #define KLDR_ERR_NOT_MAPPED (KLDR_ERR_BASE + 29) 188 /** Couldn't fit the address value into the field. Typically a relocation kind of error. */ 189 #define KLDR_ERR_ADDRESS_OVERFLOW (KLDR_ERR_BASE + 30) 190 /** Couldn't fit a calculated size value into the native size type of the host. */ 191 #define KLDR_ERR_SIZE_OVERFLOW (KLDR_ERR_BASE + 31) 192 /** Thread attach failed. */ 193 #define KLDR_ERR_THREAD_ATTACH_FAILED (KLDR_ERR_BASE + 32) 194 /** The module wasn't a DLL or object file. */ 195 #define KLDR_ERR_NOT_DLL (KLDR_ERR_BASE + 33) 196 /** The module wasn't an EXE. */ 197 #define KLDR_ERR_NOT_EXE (KLDR_ERR_BASE + 34) 198 /** Not implemented yet. */ 199 #define KLDR_ERR_TODO (KLDR_ERR_BASE + 35) 200 /** @} */ 201 202 /** @name kLdrModPE Specific 203 * @{ 204 */ 205 #define KLDR_ERR_PE_BASE (KLDR_ERR_BASE + 36) 206 /** The machine isn't supported by the interpreter. */ 207 #define KLDR_ERR_PE_UNSUPPORTED_MACHINE (KLDR_ERR_PE_BASE + 0) 208 /** The file handler isn't valid. */ 209 #define KLDR_ERR_PE_BAD_FILE_HEADER (KLDR_ERR_PE_BASE + 1) 210 /** The the optional headers isn't valid. */ 211 #define KLDR_ERR_PE_BAD_OPTIONAL_HEADER (KLDR_ERR_PE_BASE + 2) 212 /** One of the section headers aren't valid. */ 213 #define KLDR_ERR_PE_BAD_SECTION_HEADER (KLDR_ERR_PE_BASE + 3) 214 /** Bad forwarder entry. */ 215 #define KLDR_ERR_PE_BAD_FORWARDER (KLDR_ERR_PE_BASE + 4) 216 /** Forwarder module not found in the import descriptor table. */ 217 #define KLDR_ERR_PE_FORWARDER_IMPORT_NOT_FOUND (KLDR_ERR_PE_BASE + 5) 218 /** Bad PE fixups. */ 219 #define KLDR_ERR_PE_BAD_FIXUP (KLDR_ERR_PE_BASE + 6) 220 /** Bad PE import (thunk). */ 221 #define KLDR_ERR_PE_BAD_IMPORT (KLDR_ERR_PE_BASE + 7) 222 /** @} */ 223 224 /** @name kLdrModLX Specific 225 * @{ 226 */ 227 #define KLDR_ERR_LX_BASE (KLDR_ERR_PE_BASE + 8) 228 /** validation of LX header failed. */ 229 #define KLDR_ERR_LX_BAD_HEADER (KLDR_ERR_LX_BASE + 0) 230 /** validation of the loader section (in the LX header) failed. */ 231 #define KLDR_ERR_LX_BAD_LOADER_SECTION (KLDR_ERR_LX_BASE + 1) 232 /** validation of the fixup section (in the LX header) failed. */ 233 #define KLDR_ERR_LX_BAD_FIXUP_SECTION (KLDR_ERR_LX_BASE + 2) 234 /** validation of the LX object table failed. */ 235 #define KLDR_ERR_LX_BAD_OBJECT_TABLE (KLDR_ERR_LX_BASE + 3) 236 /** A bad page map entry was encountered. */ 237 #define KLDR_ERR_LX_BAD_PAGE_MAP (KLDR_ERR_LX_BASE + 4) 238 /** Bad iterdata (EXEPACK) data. */ 239 #define KLDR_ERR_LX_BAD_ITERDATA (KLDR_ERR_LX_BASE + 5) 240 /** Bad iterdata2 (EXEPACK2) data. */ 241 #define KLDR_ERR_LX_BAD_ITERDATA2 (KLDR_ERR_LX_BASE + 6) 242 /** Bad bundle data. */ 243 #define KLDR_ERR_LX_BAD_BUNDLE (KLDR_ERR_LX_BASE + 7) 244 /** No soname. */ 245 #define KLDR_ERR_LX_NO_SONAME (KLDR_ERR_LX_BASE + 8) 246 /** Bad soname. */ 247 #define KLDR_ERR_LX_BAD_SONAME (KLDR_ERR_LX_BASE + 9) 248 /** Bad forwarder entry. */ 249 #define KLDR_ERR_LX_BAD_FORWARDER (KLDR_ERR_LX_BASE + 10) 250 /** internal fixup chain isn't implemented yet. */ 251 #define KLDR_ERR_LX_NRICHAIN_NOT_SUPPORTED (KLDR_ERR_LX_BASE + 11) 252 /** @} */ 253 254 /** @name kLdrModMachO Specific 255 * @{ 256 */ 257 #define KLDR_ERR_MACHO_BASE (KLDR_ERR_LX_BASE + 12) 258 /** Only native endian Mach-O files are supported. */ 259 #define KLDR_ERR_MACHO_OTHER_ENDIAN_NOT_SUPPORTED (KLDR_ERR_MACHO_BASE + 0) 260 /** 64-bit Mach-O files aren't supported yet. */ 261 #define KLDR_ERR_MACHO_64BIT_NOT_SUPPORTED (KLDR_ERR_MACHO_BASE + 1) 262 /** The Mach-O header is bad or contains new and unsupported features. */ 263 #define KLDR_ERR_MACHO_BAD_HEADER (KLDR_ERR_MACHO_BASE + 2) 264 /** The file type isn't supported. */ 265 #define KLDR_ERR_MACHO_UNSUPPORTED_FILE_TYPE (KLDR_ERR_MACHO_BASE + 3) 266 /** The machine (cputype / cpusubtype combination) isn't supported. */ 267 #define KLDR_ERR_MACHO_UNSUPPORTED_MACHINE (KLDR_ERR_MACHO_BASE + 4) 268 /** Bad load command(s). */ 269 #define KLDR_ERR_MACHO_BAD_LOAD_COMMAND (KLDR_ERR_MACHO_BASE + 5) 270 /** Encountered an unknown load command.*/ 271 #define KLDR_ERR_MACHO_UNKNOWN_LOAD_COMMAND (KLDR_ERR_MACHO_BASE + 6) 272 /** Encountered a load command that's not implemented.*/ 273 #define KLDR_ERR_MACHO_UNSUPPORTED_LOAD_COMMAND (KLDR_ERR_MACHO_BASE + 7) 274 /** Bad section. */ 275 #define KLDR_ERR_MACHO_BAD_SECTION (KLDR_ERR_MACHO_BASE + 8) 276 /** Encountered a section type that's not implemented.*/ 277 #define KLDR_ERR_MACHO_UNSUPPORTED_SECTION (KLDR_ERR_MACHO_BASE + 9) 278 /** Encountered a section type that's not known to the loader. (probably invalid) */ 279 #define KLDR_ERR_MACHO_UNKNOWN_SECTION (KLDR_ERR_MACHO_BASE + 10) 280 /** The sections aren't ordered by segment as expected by the loader. */ 281 #define KLDR_ERR_MACHO_BAD_SECTION_ORDER (KLDR_ERR_MACHO_BASE + 11) 282 /** The image is 32-bit and contains 64-bit load commands or vise versa. */ 283 #define KLDR_ERR_MACHO_BIT_MIX (KLDR_ERR_MACHO_BASE + 12) 284 /** Bad MH_OBJECT file. */ 285 #define KLDR_ERR_MACHO_BAD_OBJECT_FILE (KLDR_ERR_MACHO_BASE + 13) 286 /** Bad symbol table entry. */ 287 #define KLDR_ERR_MACHO_BAD_SYMBOL (KLDR_ERR_MACHO_BASE + 14) 288 /** Unsupported fixup type. */ 289 #define KLDR_ERR_MACHO_UNSUPPORTED_FIXUP_TYPE (KLDR_ERR_MACHO_BASE + 15) 290 /** @} */ 291 292 293 /** End of the valid status codes. */ 294 #define KERR_END (KLDR_ERR_MACHO_BASE + 16) 113 295 /** @}*/ 114 296 -
trunk/kStuff/include/k/kLdr.h
r3578 r3579 1013 1013 void kLdrLoadExe(PCKLDREXEARGS pArgs, void *pvOS); /** @todo fix this mess... */ 1014 1014 void kLdrDyldLoadExe(PCKLDREXEARGS pArgs, void *pvOS); 1015 1016 /** @} */ 1017 1018 /** @} */ 1019 1020 1021 /** @defgroup grp_kLdrErr kLdr Status Codes 1022 * kLdr uses a mix of native status codes and it's own status codes. 1023 * A status code of 0 means success, all other status codes means failure. 1024 * @{ 1025 */ 1026 1027 #define KLDR_ERR_BASE 420000 1028 1029 /** The image format is unknown. */ 1030 #define KLDR_ERR_UNKNOWN_FORMAT (KLDR_ERR_BASE + 0) 1031 /** The MZ image format isn't supported by this kLdr build. */ 1032 #define KLDR_ERR_MZ_NOT_SUPPORTED (KLDR_ERR_BASE + 1) 1033 /** The NE image format isn't supported by this kLdr build. */ 1034 #define KLDR_ERR_NE_NOT_SUPPORTED (KLDR_ERR_BASE + 2) 1035 /** The LX image format isn't supported by this kLdr build. */ 1036 #define KLDR_ERR_LX_NOT_SUPPORTED (KLDR_ERR_BASE + 3) 1037 /** The LE image format isn't supported by this kLdr build. */ 1038 #define KLDR_ERR_LE_NOT_SUPPORTED (KLDR_ERR_BASE + 4) 1039 /** The PE image format isn't supported by this kLdr build. */ 1040 #define KLDR_ERR_PE_NOT_SUPPORTED (KLDR_ERR_BASE + 5) 1041 /** The ELF image format isn't supported by this kLdr build. */ 1042 #define KLDR_ERR_ELF_NOT_SUPPORTED (KLDR_ERR_BASE + 6) 1043 /** The mach-o image format isn't supported by this kLdr build. */ 1044 #define KLDR_ERR_MACHO_NOT_SUPPORTED (KLDR_ERR_BASE + 7) 1045 /** The FAT image format isn't supported by this kLdr build or 1046 * a direct open was attempt without going thru the FAT file provider. 1047 * FAT images are also known as Universal Binaries. */ 1048 #define KLDR_ERR_FAT_NOT_SUPPORTED (KLDR_ERR_BASE + 8) 1049 /** The a.out image format isn't supported by this kLdr build. */ 1050 #define KLDR_ERR_AOUT_NOT_SUPPORTED (KLDR_ERR_BASE + 9) 1051 1052 /** Invalid parameter to a kLdr API. */ 1053 #define KLDR_ERR_INVALID_PARAMETER (KLDR_ERR_BASE + 32) 1054 /** Invalid handle parameter to a kLdr API. */ 1055 #define KLDR_ERR_INVALID_HANDLE (KLDR_ERR_BASE + 33) 1056 /** The module wasn't loaded dynamically. */ 1057 #define KLDR_ERR_NOT_LOADED_DYNAMICALLY (KLDR_ERR_BASE + 34) 1058 /** The module wasn't found. */ 1059 #define KLDR_ERR_MODULE_NOT_FOUND (KLDR_ERR_BASE + 35) 1060 /** A prerequisit module wasn't found. */ 1061 #define KLDR_ERR_PREREQUISITE_MODULE_NOT_FOUND (KLDR_ERR_BASE + 36) 1062 /** The module is being terminated and can therefore not be loaded. */ 1063 #define KLDR_ERR_MODULE_TERMINATING (KLDR_ERR_BASE + 37) 1064 /** A prerequisit module is being terminated and can therefore not be loaded. */ 1065 #define KLDR_ERR_PREREQUISITE_MODULE_TERMINATING (KLDR_ERR_BASE + 38) 1066 /** The module initialization failed. */ 1067 #define KLDR_ERR_MODULE_INIT_FAILED (KLDR_ERR_BASE + 39) 1068 /** The initialization of a prerequisite module failed. */ 1069 #define KLDR_ERR_PREREQUISITE_MODULE_INIT_FAILED (KLDR_ERR_BASE + 40) 1070 /** The module has already failed initialization and can't be attempted reloaded until 1071 * after we've finished garbage collection. */ 1072 #define KLDR_ERR_MODULE_INIT_FAILED_ALREADY (KLDR_ERR_BASE + 41) 1073 /** A prerequisite module has already failed initialization and can't be attempted 1074 * reloaded until after we've finished garbage collection. */ 1075 #define KLDR_ERR_PREREQUISITE_MODULE_INIT_FAILED_ALREADY (KLDR_ERR_BASE + 42) 1076 /** Prerequisite recursed too deeply. */ 1077 #define KLDR_ERR_PREREQUISITE_RECURSED_TOO_DEEPLY (KLDR_ERR_BASE + 43) 1078 /** Failed to allocate the main stack. */ 1079 #define KLDR_ERR_MAIN_STACK_ALLOC_FAILED (KLDR_ERR_BASE + 44) 1080 /** Buffer overflow. */ 1081 #define KLDR_ERR_BUFFER_OVERFLOW (KLDR_ERR_BASE + 45) 1082 /** The specified ARCH+CPU isn't compatible with image. */ 1083 #define KLDR_ERR_ARCH_CPU_NOT_COMPATIBLE (KLDR_ERR_BASE + 46) 1084 /** Symbol not found. */ 1085 #define KLDR_ERR_SYMBOL_NOT_FOUND (KLDR_ERR_BASE + 47) 1086 /** A forward symbol was encountered but the caller didn't provide any means to resolve it. */ 1087 #define KLDR_ERR_FORWARDER_SYMBOL (KLDR_ERR_BASE + 48) 1088 /** Encountered a bad fixup. */ 1089 #define KLDR_ERR_BAD_FIXUP (KLDR_ERR_BASE + 49) 1090 /** A memory allocation failed. */ 1091 #define KLDR_ERR_NO_MEMORY (KLDR_ERR_BASE + 50) 1092 /** The import ordinal was out of bounds. */ 1093 #define KLDR_ERR_IMPORT_ORDINAL_OUT_OF_BOUNDS (KLDR_ERR_BASE + 51) 1094 /** A forwarder chain was too long. */ 1095 #define KLDR_ERR_TOO_LONG_FORWARDER_CHAIN (KLDR_ERR_BASE + 52) 1096 /** The module has no debug info. */ 1097 #define KLDR_ERR_NO_DEBUG_INFO (KLDR_ERR_BASE + 53) 1098 /** The module is already mapped. 1099 * kLdrModMap() can only be called once (without kLdrModUnmap() in between). */ 1100 #define KLDR_ERR_ALREADY_MAPPED (KLDR_ERR_BASE + 54) 1101 /** The module was not mapped. 1102 * kLdrModUnmap() should not called without being preceeded by a kLdrModMap(). */ 1103 #define KLDR_ERR_NOT_MAPPED (KLDR_ERR_BASE + 55) 1104 /** Couldn't fit the address value into the field. Typically a relocation kind of error. */ 1105 #define KLDR_ERR_ADDRESS_OVERFLOW (KLDR_ERR_BASE + 56) 1106 /** Couldn't fit a calculated size value into the native size type of the host. */ 1107 #define KLDR_ERR_SIZE_OVERFLOW (KLDR_ERR_BASE + 57) 1108 /** Thread attach failed. */ 1109 #define KLDR_ERR_THREAD_ATTACH_FAILED (KLDR_ERR_BASE + 58) 1110 /** The file reader can't take more concurrent mappings. */ 1111 #define KLDR_ERR_TOO_MANY_MAPPINGS (KLDR_ERR_BASE + 59) 1112 /** The module wasn't a DLL or object file. */ 1113 #define KLDR_ERR_NOT_DLL (KLDR_ERR_BASE + 60) 1114 /** The module wasn't an EXE. */ 1115 #define KLDR_ERR_NOT_EXE (KLDR_ERR_BASE + 61) 1116 /** Not implemented yet. */ 1117 #define KLDR_ERR_TODO (KLDR_ERR_BASE + 62) 1118 1119 1120 /** @name kLdrModPE status codes 1121 * @{ */ 1122 #define KLDR_ERR_PE_BASE (KLDR_ERR_BASE + 63) 1123 /** The machine isn't supported by the interpreter. */ 1124 #define KLDR_ERR_PE_UNSUPPORTED_MACHINE (KLDR_ERR_PE_BASE + 0) 1125 /** The file handler isn't valid. */ 1126 #define KLDR_ERR_PE_BAD_FILE_HEADER (KLDR_ERR_PE_BASE + 1) 1127 /** The the optional headers isn't valid. */ 1128 #define KLDR_ERR_PE_BAD_OPTIONAL_HEADER (KLDR_ERR_PE_BASE + 2) 1129 /** One of the section headers aren't valid. */ 1130 #define KLDR_ERR_PE_BAD_SECTION_HEADER (KLDR_ERR_PE_BASE + 3) 1131 /** Bad forwarder entry. */ 1132 #define KLDR_ERR_PE_BAD_FORWARDER (KLDR_ERR_PE_BASE + 4) 1133 /** Forwarder module not found in the import descriptor table. */ 1134 #define KLDR_ERR_PE_FORWARDER_IMPORT_NOT_FOUND (KLDR_ERR_PE_BASE + 5) 1135 /** Bad PE fixups. */ 1136 #define KLDR_ERR_PE_BAD_FIXUP (KLDR_ERR_PE_BASE + 6) 1137 /** Bad PE import (thunk). */ 1138 #define KLDR_ERR_PE_BAD_IMPORT (KLDR_ERR_PE_BASE + 7) 1139 /** @} */ 1140 1141 /** @name kLdrModLX status codes 1142 * @{ */ 1143 #define KLDR_ERR_LX_BASE (KLDR_ERR_PE_BASE + 8) 1144 /** validation of LX header failed. */ 1145 #define KLDR_ERR_LX_BAD_HEADER (KLDR_ERR_LX_BASE + 0) 1146 /** validation of the loader section (in the LX header) failed. */ 1147 #define KLDR_ERR_LX_BAD_LOADER_SECTION (KLDR_ERR_LX_BASE + 1) 1148 /** validation of the fixup section (in the LX header) failed. */ 1149 #define KLDR_ERR_LX_BAD_FIXUP_SECTION (KLDR_ERR_LX_BASE + 2) 1150 /** validation of the LX object table failed. */ 1151 #define KLDR_ERR_LX_BAD_OBJECT_TABLE (KLDR_ERR_LX_BASE + 3) 1152 /** A bad page map entry was encountered. */ 1153 #define KLDR_ERR_LX_BAD_PAGE_MAP (KLDR_ERR_LX_BASE + 4) 1154 /** Bad iterdata (EXEPACK) data. */ 1155 #define KLDR_ERR_LX_BAD_ITERDATA (KLDR_ERR_LX_BASE + 5) 1156 /** Bad iterdata2 (EXEPACK2) data. */ 1157 #define KLDR_ERR_LX_BAD_ITERDATA2 (KLDR_ERR_LX_BASE + 6) 1158 /** Bad bundle data. */ 1159 #define KLDR_ERR_LX_BAD_BUNDLE (KLDR_ERR_LX_BASE + 7) 1160 /** No soname. */ 1161 #define KLDR_ERR_LX_NO_SONAME (KLDR_ERR_LX_BASE + 8) 1162 /** Bad soname. */ 1163 #define KLDR_ERR_LX_BAD_SONAME (KLDR_ERR_LX_BASE + 9) 1164 /** Bad forwarder entry. */ 1165 #define KLDR_ERR_LX_BAD_FORWARDER (KLDR_ERR_LX_BASE + 10) 1166 /** internal fixup chain isn't implemented yet. */ 1167 #define KLDR_ERR_LX_NRICHAIN_NOT_SUPPORTED (KLDR_ERR_LX_BASE + 11) 1168 /** @} */ 1169 1170 /** @name 1171 * @{ */ 1172 #define KLDR_ERR_MACHO_BASE (KLDR_ERR_LX_BASE + 12) 1173 /** Only native endian Mach-O files are supported. */ 1174 #define KLDR_ERR_MACHO_OTHER_ENDIAN_NOT_SUPPORTED (KLDR_ERR_MACHO_BASE + 0) 1175 /** 64-bit Mach-O files aren't supported yet. */ 1176 #define KLDR_ERR_MACHO_64BIT_NOT_SUPPORTED (KLDR_ERR_MACHO_BASE + 1) 1177 /** The Mach-O header is bad or contains new and unsupported features. */ 1178 #define KLDR_ERR_MACHO_BAD_HEADER (KLDR_ERR_MACHO_BASE + 2) 1179 /** The file type isn't supported. */ 1180 #define KLDR_ERR_MACHO_UNSUPPORTED_FILE_TYPE (KLDR_ERR_MACHO_BASE + 3) 1181 /** The machine (cputype / cpusubtype combination) isn't supported. */ 1182 #define KLDR_ERR_MACHO_UNSUPPORTED_MACHINE (KLDR_ERR_MACHO_BASE + 4) 1183 /** Bad load command(s). */ 1184 #define KLDR_ERR_MACHO_BAD_LOAD_COMMAND (KLDR_ERR_MACHO_BASE + 5) 1185 /** Encountered an unknown load command.*/ 1186 #define KLDR_ERR_MACHO_UNKNOWN_LOAD_COMMAND (KLDR_ERR_MACHO_BASE + 6) 1187 /** Encountered a load command that's not implemented.*/ 1188 #define KLDR_ERR_MACHO_UNSUPPORTED_LOAD_COMMAND (KLDR_ERR_MACHO_BASE + 7) 1189 /** Bad section. */ 1190 #define KLDR_ERR_MACHO_BAD_SECTION (KLDR_ERR_MACHO_BASE + 8) 1191 /** Encountered a section type that's not implemented.*/ 1192 #define KLDR_ERR_MACHO_UNSUPPORTED_SECTION (KLDR_ERR_MACHO_BASE + 9) 1193 /** Encountered a section type that's not known to the loader. (probably invalid) */ 1194 #define KLDR_ERR_MACHO_UNKNOWN_SECTION (KLDR_ERR_MACHO_BASE + 10) 1195 /** The sections aren't ordered by segment as expected by the loader. */ 1196 #define KLDR_ERR_MACHO_BAD_SECTION_ORDER (KLDR_ERR_MACHO_BASE + 11) 1197 /** The image is 32-bit and contains 64-bit load commands or vise versa. */ 1198 #define KLDR_ERR_MACHO_BIT_MIX (KLDR_ERR_MACHO_BASE + 12) 1199 /** Bad MH_OBJECT file. */ 1200 #define KLDR_ERR_MACHO_BAD_OBJECT_FILE (KLDR_ERR_MACHO_BASE + 13) 1201 /** Bad symbol table entry. */ 1202 #define KLDR_ERR_MACHO_BAD_SYMBOL (KLDR_ERR_MACHO_BASE + 14) 1203 /** Unsupported fixup type. */ 1204 #define KLDR_ERR_MACHO_UNSUPPORTED_FIXUP_TYPE (KLDR_ERR_MACHO_BASE + 15) 1205 /** @} */ 1206 1207 /** End of the valid kLdr status codes. */ 1208 #define KLDR_ERR_END (KLDR_ERR_MACHO_BASE + 16) 1209 1210 const char *kLdrErrStr(int rc); 1211 1212 /** @} */ 1213 1015 /** @} */ 1016 1017 /** @} */ 1018 1019 /** @} */ 1214 1020 1215 1021 #ifdef __cplusplus -
trunk/kStuff/kHlp/Makefile.kmk
r3578 r3579 110 110 CRT/kHlpCRTString.cpp \ 111 111 112 112 113 # Generate the rules 113 114 include $(PATH_KBUILD)/footer.kmk -
trunk/kStuff/kLdr/Makefile.kmk
r3578 r3579 120 120 kLdrDyldOS.c \ 121 121 kLdrDyLdSem.c \ 122 kLdrErr.c \123 122 kLdrMisc.c \ 124 123 kLdrMod.c \ … … 136 135 kLdr_LIBS += \ 137 136 $(PATH_LIB)/kRdrStatic$(SUFF_LIB) \ 138 $(PATH_LIB)/kHlpBareStatic$(SUFF_LIB) 139 140 kLdrErr.c_DEPS = $(PATH_TARGET)/kldrErrConsts.h 141 kLdrErr.c_INCS = $(PATH_TARGET) 137 $(PATH_LIB)/kHlpBareStatic$(SUFF_LIB) \ 138 $(PATH_LIB)/kErrStatic$(SUFF_LIB) 142 139 143 140 # … … 222 219 223 220 224 # 225 # Generate case statements for kLdrErrStr(). 226 # 227 $(PATH_TARGET)/kldrErrConsts.h: ../include/k/kLdr.h Makefile.kmk | $(call DIRDEP,$(PATH_TARGET)) 228 $(RM) -f $@ 229 $(SED) \ 230 -e '/^#define *\(KLDR_ERR_[^ ()]*\) .*$$/!d' \ 231 -e 's/^#define *\(KLDR_ERR_[^ ()]*\) .*$$/ERR_CONST(\1)/' \ 232 -e '/KLDR_ERR_BASE/d' \ 233 -e '/KLDR_ERR_[^_]*_BASE/d' \ 234 ../include/k/kLdr.h > $@ 235 221 -
trunk/kStuff/kLdr/kLdr-os2.def
r3578 r3579 108 108 109 109 ; Error APIs: 110 _k LdrErrStr110 _kErrStr 111 111 112 112 -
trunk/kStuff/kLdr/kLdr-win.def
r3578 r3579 107 107 108 108 ; Error APIs: 109 k LdrErrStr109 kErrName 110 110 -
trunk/kStuff/kLdr/kLdrDyld.c
r3576 r3579 253 253 | KLDRDYLD_LOAD_FLAGS_RECURSIVE_INIT 254 254 | KLDRYDLD_LOAD_FLAGS_SPECIFIC_MODULE)) 255 kldrDyldFailure(K LDR_ERR_INVALID_PARAMETER, "Bad fFlags=%#x", pArgs->fFlags);255 kldrDyldFailure(KERR_INVALID_PARAMETER, "Bad fFlags=%#x", pArgs->fFlags); 256 256 if ( pArgs->enmSearch <= KLDRDYLD_SEARCH_INVALID 257 257 || pArgs->enmSearch >= KLDRDYLD_SEARCH_END) 258 kldrDyldFailure(K LDR_ERR_INVALID_PARAMETER, "Bad enmSearch=%d", pArgs->enmSearch);258 kldrDyldFailure(KERR_INVALID_PARAMETER, "Bad enmSearch=%d", pArgs->enmSearch); 259 259 260 260 /* … … 461 461 * 462 462 * @returns 0 on success and pszName filled with the name. 463 * @returns K LDR_ERR_INVALID_HANDLE or KLDR_ERR_BUFFER_OVERFLOW on failure.463 * @returns KERR_INVALID_HANDLE or KERR_BUFFER_OVERFLOW on failure. 464 464 * @param hMod The module handle. 465 465 * @param pszName Where to put the name. … … 492 492 * 493 493 * @returns 0 on success and pszFilename filled with the name. 494 * @returns K LDR_ERR_INVALID_HANDLE or KLDR_ERR_BUFFER_OVERFLOW on failure.494 * @returns KERR_INVALID_HANDLE or KERR_BUFFER_OVERFLOW on failure. 495 495 * @param hMod The module handle. 496 496 * @param pszFilename Where to put the filename. … … 523 523 * 524 524 * @returns 0 on success and pValue and pfKind set. 525 * @returns K LDR_ERR_INVALID_HANDLE or KLDR_ERR_SYMBOL_NOT_FOUND on failure.525 * @returns KERR_INVALID_HANDLE or KLDR_ERR_SYMBOL_NOT_FOUND on failure. 526 526 * @param hMod The module handle. 527 527 * @param uSymbolOrdinal The symbol ordinal. This is ignored if pszSymbolName is non-zero. … … 542 542 *pValue = 0; 543 543 if (!pfKind && !pValue) 544 return K LDR_ERR_INVALID_PARAMETER;544 return KERR_INVALID_PARAMETER; 545 545 KLDRDYLD_VALIDATE_HKLDRMOD(hMod); 546 546 K_VALIDATE_OPTIONAL_STRING(pszSymbolName); … … 1073 1073 * Records the module. 1074 1074 * 1075 * @return 0 on success, K LDR_ERR_NO_MEMORY if we can't expand the table.1075 * @return 0 on success, KERR_NO_MEMORY if we can't expand the table. 1076 1076 * @param pMod The module to record. 1077 1077 */ … … 1087 1087 void *pvNew = kHlpAlloc(cNew * sizeof(g_papStackMods[0])); 1088 1088 if (!pvNew) 1089 return K LDR_ERR_NO_MEMORY;1089 return KERR_NO_MEMORY; 1090 1090 kHlpMemCopy(pvNew, pvOld, g_cStackMods * sizeof(g_papStackMods[0])); 1091 1091 g_papStackMods = (PPKLDRDYLDMOD)pvNew; -
trunk/kStuff/kLdr/kLdrDyldFind.c
r3578 r3579 620 620 return 0; 621 621 /** @todo deal with return codes properly. */ 622 if (rc >= K LDR_ERR_BASE && rc <= KLDR_ERR_END)622 if (rc >= KERR_BASE && rc <= KERR_END) 623 623 return rc; 624 624 … … 772 772 * Resolve default search method, prefix and suffix. 773 773 * 774 * @returns 0 on success, K LDR_ERR_INVALID_PARAMETER on failure.774 * @returns 0 on success, KERR_INVALID_PARAMETER on failure. 775 775 * @param penmSearch The search method. In/Out. 776 776 * @param ppszPrefix The prefix. In/Out. … … 828 828 default: 829 829 KLDRDYLDFIND_ASSERT(!"invalid search method"); 830 return K LDR_ERR_INVALID_PARAMETER;830 return KERR_INVALID_PARAMETER; 831 831 } 832 832 -
trunk/kStuff/kLdr/kLdrDyldMod.c
r3578 r3579 182 182 { 183 183 kLdrModClose(pRawMod); 184 rc = K LDR_ERR_NO_MEMORY;184 rc = KERR_NO_MEMORY; 185 185 } 186 186 return rc; … … 762 762 pMod->papPrereqs = (PPKLDRDYLDMOD)kHlpAllocZ(sizeof(pMod->papPrereqs[0]) * cPrereqs); 763 763 if (!pMod->papPrereqs) 764 return K LDR_ERR_NO_MEMORY;764 return KERR_NO_MEMORY; 765 765 pMod->cPrereqs = cPrereqs; 766 766 } … … 1224 1224 * Gets the module name. 1225 1225 * 1226 * @returns 0 on success, K LDR_ERR_BUFFER_OVERFLOW on failure.1226 * @returns 0 on success, KERR_BUFFER_OVERFLOW on failure. 1227 1227 * @param pMod The module. 1228 1228 * @param pszName Where to store the name. … … 1237 1237 pszName[cch - 1] = '\0'; 1238 1238 } 1239 return cchName <= pMod->pMod->cchName ? K LDR_ERR_BUFFER_OVERFLOW : 0;1239 return cchName <= pMod->pMod->cchName ? KERR_BUFFER_OVERFLOW : 0; 1240 1240 } 1241 1241 … … 1244 1244 * Gets the module filename. 1245 1245 * 1246 * @returns 0 on success, K LDR_ERR_BUFFER_OVERFLOW on failure.1246 * @returns 0 on success, KERR_BUFFER_OVERFLOW on failure. 1247 1247 * @param pMod The module. 1248 1248 * @param pszFilename Where to store the filename. … … 1257 1257 pszFilename[cch - 1] = '\0'; 1258 1258 } 1259 return cchFilename <= pMod->pMod->cchFilename ? K LDR_ERR_BUFFER_OVERFLOW : 0;1259 return cchFilename <= pMod->pMod->cchFilename ? KERR_BUFFER_OVERFLOW : 0; 1260 1260 } 1261 1261 -
trunk/kStuff/kLdr/kLdrInternal.h
r3578 r3579 329 329 || (hMod)->u32MagicTail != KLDRDYMOD_MAGIC) \ 330 330 { \ 331 return K LDR_ERR_INVALID_HANDLE; \331 return KERR_INVALID_HANDLE; \ 332 332 } \ 333 333 } while (0) -
trunk/kStuff/kLdr/kLdrMisc.c
r3573 r3579 59 59 case KLDRARCH_X86_16: 60 60 if (enmCpu < KLDRCPU_FIRST_X86_16 || enmCpu > KLDRCPU_LAST_X86_16) 61 return K LDR_ERR_INVALID_PARAMETER;61 return KERR_INVALID_PARAMETER; 62 62 63 63 /* intel? */ … … 83 83 case KLDRARCH_X86_32: 84 84 if (enmCpu < KLDRCPU_FIRST_X86_32 || enmCpu > KLDRCPU_LAST_X86_32) 85 return K LDR_ERR_INVALID_PARAMETER;85 return KERR_INVALID_PARAMETER; 86 86 87 87 /* blend? */ … … 111 111 case KLDRARCH_AMD64: 112 112 if (enmCpu < KLDRCPU_FIRST_AMD64 || enmCpu > KLDRCPU_LAST_AMD64) 113 return K LDR_ERR_INVALID_PARAMETER;113 return KERR_INVALID_PARAMETER; 114 114 115 115 /* blend? */ -
trunk/kStuff/kLdr/kLdrMod.c
r3578 r3579 70 70 /** Return / crash validation of a module argument. */ 71 71 #define KLDRMOD_VALIDATE(pMod) \ 72 KLDRMOD_VALIDATE_EX(pMod, K LDR_ERR_INVALID_PARAMETER)72 KLDRMOD_VALIDATE_EX(pMod, KERR_INVALID_PARAMETER) 73 73 74 74 /** Return / crash validation of a module argument. */ … … 263 263 KLDRMOD_VALIDATE(pMod); 264 264 if (!puValue && !pfKind) 265 return K LDR_ERR_INVALID_PARAMETER;265 return KERR_INVALID_PARAMETER; 266 266 if (puValue) 267 267 *puValue = 0; … … 300 300 * 301 301 * @returns 0 and name in pszName on success. 302 * On buffer overruns K LDR_ERR_BUFFER_OVERFLOW will be returned.302 * On buffer overruns KERR_BUFFER_OVERFLOW will be returned. 303 303 * On other failures and appropriate error code is returned. 304 304 * @param pMod The module. … … 421 421 KLDRMOD_VALIDATE(pMod); 422 422 if (!pAddrRsrc && !pcbRsrc) 423 return K LDR_ERR_INVALID_PARAMETER;423 return KERR_INVALID_PARAMETER; 424 424 if (pAddrRsrc) 425 425 *pAddrRsrc = NIL_KLDRADDR; -
trunk/kStuff/kLdr/kLdrModLX.c
r3578 r3579 273 273 pModLX = (PKLDRMODLX)kHlpAlloc(cb); 274 274 if (!pModLX) 275 return K LDR_ERR_NO_MEMORY;275 return KERR_NO_MEMORY; 276 276 *ppModLX = pModLX; 277 277 … … 938 938 pv = kHlpAlloc(pModLX->Hdr.e32_fixupsize); 939 939 if (!pv) 940 return K LDR_ERR_NO_MEMORY;940 return KERR_NO_MEMORY; 941 941 942 942 off = pModLX->Hdr.e32_objtab + pModLX->Hdr.e32_ldrsize; … … 1216 1216 if (cchName) 1217 1217 pszName[cchName - 1] = '\0'; 1218 rc = K LDR_ERR_BUFFER_OVERFLOW;1218 rc = KERR_BUFFER_OVERFLOW; 1219 1219 } 1220 1220 -
trunk/kStuff/kLdr/kLdrModMachO.c
r3578 r3579 280 280 pbLoadCommands = kHlpAlloc(s.Hdr32.sizeofcmds); 281 281 if (!pbLoadCommands) 282 return K LDR_ERR_NO_MEMORY;282 return KERR_NO_MEMORY; 283 283 rc = kRdrRead(pRdr, pbLoadCommands, s.Hdr32.sizeofcmds, 284 284 s.Hdr32.magic == IMAGE_MACHO32_SIGNATURE … … 305 305 pModMachO = (PKLDRMODMACHO)kHlpAlloc(cb); 306 306 if (!pModMachO) 307 return K LDR_ERR_NO_MEMORY;307 return KERR_NO_MEMORY; 308 308 *ppModMachO = pModMachO; 309 309 pModMachO->pbLoadCommands = pbLoadCommands; … … 639 639 640 640 default: 641 return K LDR_ERR_INVALID_PARAMETER;641 return KERR_INVALID_PARAMETER; 642 642 } 643 643 … … 925 925 926 926 default: 927 return K LDR_ERR_INVALID_PARAMETER;927 return KERR_INVALID_PARAMETER; 928 928 } 929 929 … … 2140 2140 if (cbSyms / cbSym != pModMachO->cSymbols) 2141 2141 return KLDR_ERR_SIZE_OVERFLOW; 2142 rc = K LDR_ERR_NO_MEMORY;2142 rc = KERR_NO_MEMORY; 2143 2143 pvSyms = kHlpAlloc(cbSyms); 2144 2144 if (pvSyms) … … 2221 2221 paFixups = (macho_relocation_info_t *)kHlpAlloc(cbFixups); 2222 2222 if (!paFixups) 2223 return K LDR_ERR_NO_MEMORY;2223 return KERR_NO_MEMORY; 2224 2224 2225 2225 /* read the fixups. */ -
trunk/kStuff/kLdr/kLdrModNative.c
r3578 r3579 305 305 pModNative = (PKLDRMODNATIVE)kHlpAlloc(cb); 306 306 if (!pModNative) 307 return K LDR_ERR_NO_MEMORY;307 return KERR_NO_MEMORY; 308 308 309 309 /* KLDRMOD */ … … 766 766 if (cchName) 767 767 pszName[cchName - 1] = '\0'; 768 rc = K LDR_ERR_BUFFER_OVERFLOW;768 rc = KERR_BUFFER_OVERFLOW; 769 769 } 770 770 -
trunk/kStuff/kLdr/kLdrModPE.c
r3578 r3579 205 205 pModPE = (PKLDRMODPE)kHlpAlloc(cb); 206 206 if (!pModPE) 207 return K LDR_ERR_NO_MEMORY;207 return KERR_NO_MEMORY; 208 208 *ppModPE = pModPE; 209 209 … … 1050 1050 if (cchName) 1051 1051 pszName[cchName - 1] = '\0'; 1052 rc = K LDR_ERR_BUFFER_OVERFLOW;1052 rc = KERR_BUFFER_OVERFLOW; 1053 1053 } 1054 1054 -
trunk/kStuff/kLdr/testcase/tst-3-driver.c
r2967 r3579 120 120 rc = kLdrModOpen(pszFile, &pMod); 121 121 if (rc) 122 return Failure("kLdrModOpen(%s,) -> %#d (%s)\n", pszFile, rc, k LdrErrStr(rc));122 return Failure("kLdrModOpen(%s,) -> %#d (%s)\n", pszFile, rc, kErrName(rc)); 123 123 124 124 /* get bits. */ … … 163 163 } 164 164 else 165 Failure("kLdrModRelocateBits(,,, + 0x22000,,,) -> %#x (%s)\n", rc, k LdrErrStr(rc));165 Failure("kLdrModRelocateBits(,,, + 0x22000,,,) -> %#x (%s)\n", rc, kErrName(rc)); 166 166 } 167 167 else 168 Failure("kLdrModRelocateBits(,, + 0x22000,,,,) -> %#x (%s)\n", rc, k LdrErrStr(rc));168 Failure("kLdrModRelocateBits(,, + 0x22000,,,,) -> %#x (%s)\n", rc, kErrName(rc)); 169 169 } 170 170 else … … 172 172 } 173 173 else 174 Failure("kLdrModQuerySymbol -> %#x (%s)\n", rc, k LdrErrStr(rc));174 Failure("kLdrModQuerySymbol -> %#x (%s)\n", rc, kErrName(rc)); 175 175 } 176 176 else 177 Failure("kLdrModGetBits -> %#x (%s)\n", rc, k LdrErrStr(rc));177 Failure("kLdrModGetBits -> %#x (%s)\n", rc, kErrName(rc)); 178 178 free(pvBits); 179 179 } … … 184 184 rc = kLdrModClose(pMod); 185 185 if (rc) 186 Failure("kLdrModOpen(%s,) -> %#x (%s)\n", pszFile, rc, k LdrErrStr(rc));186 Failure("kLdrModOpen(%s,) -> %#x (%s)\n", pszFile, rc, kErrName(rc)); 187 187 return 0; 188 188 } -
trunk/kStuff/kLdr/tstkLdrMod.c
r3571 r3579 30 30 *******************************************************************************/ 31 31 #include <k/kLdr.h> 32 #include <k/kErr.h> 33 #include <k/kErrors.h> 34 32 35 #include <stdarg.h> 33 36 #include <stdio.h> … … 116 119 rc = kLdrModGetBits(pMod, pvBits2, (KUPTR)pvBits, BasicTestsGetImport, NULL); 117 120 if (rc) 118 return Failure("failed to get image bits, rc=%d (%s) (a)", rc, k LdrErrStr(rc));121 return Failure("failed to get image bits, rc=%d (%s) (a)", rc, kErrName(rc)); 119 122 if (TestMemComp(pvBits2, pvBits, cbImage)) 120 123 return Failure("relocation test failed, mismatching bits (a)"); … … 125 128 rc = kLdrModRelocateBits(pMod, pvBits2, 0x1000, (KUPTR)pvBits, BasicTestsGetImport, NULL); 126 129 if (rc) 127 return Failure("failed to relocate, rc=%d (%s) (b1)", rc, k LdrErrStr(rc));130 return Failure("failed to relocate, rc=%d (%s) (b1)", rc, kErrName(rc)); 128 131 rc = kLdrModRelocateBits(pMod, pvBits2, (KUPTR)pvBits, 0x1000, BasicTestsGetImport, NULL); 129 132 if (rc) 130 return Failure("failed to relocate, rc=%d (%s) (b2)", rc, k LdrErrStr(rc));133 return Failure("failed to relocate, rc=%d (%s) (b2)", rc, kErrName(rc)); 131 134 if (TestMemComp(pvBits2, pvBits, cbImage)) 132 135 return Failure("relocation test failed, mismatching bits (b)"); … … 138 141 rc = kLdrModRelocateBits(pMod, pvBits, 0x1000000, (KUPTR)pvBits, BasicTestsGetImport, NULL); 139 142 if (rc) 140 return Failure("failed to relocate, rc=%d (%s) (c1)", rc, k LdrErrStr(rc));143 return Failure("failed to relocate, rc=%d (%s) (c1)", rc, kErrName(rc)); 141 144 memset(pvBits2, 0xfe, cbImage); 142 145 rc = kLdrModGetBits(pMod, pvBits2, 0x1000000, BasicTestsGetImport, NULL); 143 146 if (rc) 144 return Failure("failed to get image bits, rc=%d (%s) (c1)", rc, k LdrErrStr(rc));147 return Failure("failed to get image bits, rc=%d (%s) (c1)", rc, kErrName(rc)); 145 148 if (TestMemComp(pvBits2, pvBits, cbImage)) 146 149 return Failure("relocation test failed, mismatching bits (c1)"); … … 149 152 rc = kLdrModRelocateBits(pMod, pvBits, ~(KUPTR)0x1010000, 0x1000000, BasicTestsGetImport, NULL); 150 153 if (rc) 151 return Failure("failed to relocate, rc=%d (%s) (c2)", rc, k LdrErrStr(rc));154 return Failure("failed to relocate, rc=%d (%s) (c2)", rc, kErrName(rc)); 152 155 memset(pvBits2, 0xef, cbImage); 153 156 rc = kLdrModGetBits(pMod, pvBits2, ~(KUPTR)0x1010000, BasicTestsGetImport, NULL); 154 157 if (rc) 155 return Failure("failed to get image bits, rc=%d (%s) (c2)", rc, k LdrErrStr(rc));158 return Failure("failed to get image bits, rc=%d (%s) (c2)", rc, kErrName(rc)); 156 159 if (TestMemComp(pvBits2, pvBits, cbImage)) 157 160 return Failure("relocation test failed, mismatching bits (c2)"); … … 160 163 rc = kLdrModRelocateBits(pMod, pvBits, MY_BASEADDRESS, ~(KUPTR)0x1010000, BasicTestsGetImport, NULL); 161 164 if (rc) 162 return Failure("failed to relocate, rc=%d (%s) (c3)", rc, k LdrErrStr(rc));165 return Failure("failed to relocate, rc=%d (%s) (c3)", rc, kErrName(rc)); 163 166 memset(pvBits2, 0xef, cbImage); 164 167 rc = kLdrModGetBits(pMod, pvBits2, MY_BASEADDRESS, BasicTestsGetImport, NULL); 165 168 if (rc) 166 return Failure("failed to get image bits, rc=%d (%s) (c3)", rc, k LdrErrStr(rc));169 return Failure("failed to get image bits, rc=%d (%s) (c3)", rc, kErrName(rc)); 167 170 if (TestMemComp(pvBits2, pvBits, cbImage)) 168 171 return Failure("relocation test failed, mismatching bits (c3)"); … … 171 174 rc = kLdrModRelocateBits(pMod, pvBits, ~(KUPTR)0 / 2 - 0x10000, MY_BASEADDRESS, BasicTestsGetImport, NULL); 172 175 if (rc) 173 return Failure("failed to relocate, rc=%d %(s) (c4)", rc, k LdrErrStr(rc));176 return Failure("failed to relocate, rc=%d %(s) (c4)", rc, kErrName(rc)); 174 177 memset(pvBits2, 0xdc, cbImage); 175 178 rc = kLdrModGetBits(pMod, pvBits2, ~(KUPTR)0 / 2 - 0x10000, BasicTestsGetImport, NULL); 176 179 if (rc) 177 return Failure("failed to get image bits, rc=%d (%s) (c4)", rc, k LdrErrStr(rc));180 return Failure("failed to get image bits, rc=%d (%s) (c4)", rc, kErrName(rc)); 178 181 if (TestMemComp(pvBits2, pvBits, cbImage)) 179 182 return Failure("relocation test failed, mismatching bits (c4)"); … … 182 185 rc = kLdrModRelocateBits(pMod, pvBits, (KUPTR)pvBits, ~(KUPTR)0 / 2 - 0x10000, BasicTestsGetImport, NULL); 183 186 if (rc) 184 return Failure("failed to relocate, rc=%d (%s) (c5)", rc, k LdrErrStr(rc));187 return Failure("failed to relocate, rc=%d (%s) (c5)", rc, kErrName(rc)); 185 188 memset(pvBits2, 0xcd, cbImage); 186 189 rc = kLdrModGetBits(pMod, pvBits2, (KUPTR)pvBits, BasicTestsGetImport, NULL); 187 190 if (rc) 188 return Failure("failed to get image bits, rc=%d (%s) (c5)", rc, k LdrErrStr(rc));191 return Failure("failed to get image bits, rc=%d (%s) (c5)", rc, kErrName(rc)); 189 192 if (TestMemComp(pvBits2, pvBits, cbImage)) 190 193 return Failure("relocation test failed, mismatching bits (c5)"); … … 217 220 &uValue2, &fKind2); 218 221 if (rc) 219 return Failure("Couldn't find symbol %#x (%.*s) by ordinal. rc=%d (%s)", iSymbol, cchSymbol, pchSymbol, rc, k LdrErrStr(rc));222 return Failure("Couldn't find symbol %#x (%.*s) by ordinal. rc=%d (%s)", iSymbol, cchSymbol, pchSymbol, rc, kErrName(rc)); 220 223 if (uValue != uValue2) 221 224 return Failure("Symbol %#x (%.*s): Value mismatch %016" PRI_KLDRADDR " != %016" PRI_KLDRADDR " (enum!=query/ord) pvBits=%p", … … 233 236 NULL, NULL, &uValue2, &fKind2); 234 237 if (rc) 235 return Failure("Couldn't find symbol %#x (%.*s) by name. rc=%d (%s)", iSymbol, cchSymbol, pchSymbol, rc, k LdrErrStr(rc));238 return Failure("Couldn't find symbol %#x (%.*s) by name. rc=%d (%s)", iSymbol, cchSymbol, pchSymbol, rc, kErrName(rc)); 236 239 if (uValue != uValue2) 237 240 return Failure("Symbol %#x (%.*s): Value mismatch %016" PRI_KLDRADDR " != %016" PRI_KLDRADDR " (enum!=query/name) pvBits=%p", … … 294 297 rc = kLdrModGetImport(pMod, pvBits, i, szImportModule, sizeof(szImportModule)); 295 298 if (rc) 296 return Failure("failed to get import module name, rc=%d (%s). (%.260s)", rc, k LdrErrStr(rc), szImportModule);299 return Failure("failed to get import module name, rc=%d (%s). (%.260s)", rc, kErrName(rc), szImportModule); 297 300 printf("import #%d: '%s'\n", i, szImportModule); 298 301 } … … 307 310 rc = kLdrModGetStackInfo(pMod, pvBits, MY_BASEADDRESS, &StackInfo); 308 311 if (rc) 309 return Failure("kLdrModGetStackInfo failed with rc=%d (%s)", rc, k LdrErrStr(rc));312 return Failure("kLdrModGetStackInfo failed with rc=%d (%s)", rc, kErrName(rc)); 310 313 printf("Stack: Address=%016" PRI_KLDRADDR " LinkAddress=%016" PRI_KLDRADDR "\n" 311 314 " cbStack=%016" PRI_KLDRSIZE " cbStackThread=%016" PRI_KLDRSIZE "\n", … … 326 329 rc = kLdrModQueryMainEntrypoint(pMod, pvBits, MY_BASEADDRESS, &MainEPAddress); 327 330 if (rc) 328 return Failure("kLdrModQueryMainEntrypoint failed with rc=%d (%s)", rc, k LdrErrStr(rc));331 return Failure("kLdrModQueryMainEntrypoint failed with rc=%d (%s)", rc, kErrName(rc)); 329 332 printf("Entrypoint: %016" PRI_KLDRADDR "\n", MainEPAddress); 330 333 if (MainEPAddress == ~(KLDRADDR)42) … … 344 347 printf("NO Debugger Information\n"); 345 348 else 346 return Failure("kLdrModHasDbgInfo failed with rc=%d (%s)", rc, k LdrErrStr(rc));349 return Failure("kLdrModHasDbgInfo failed with rc=%d (%s)", rc, kErrName(rc)); 347 350 rc = kLdrModEnumDbgInfo(pMod, pvBits, BasicTestEnumDbgInfoCallback, NULL); 348 351 if (rc) 349 return Failure("kLdrModEnumDbgInfo failed with rc=%d (%s)", rc, k LdrErrStr(rc));352 return Failure("kLdrModEnumDbgInfo failed with rc=%d (%s)", rc, kErrName(rc)); 350 353 351 354 … … 379 382 rc = kLdrModEnumSymbols(pMod, pvBits, MY_BASEADDRESS, 0, BasicTestsEnumSymCallback, pvBits); 380 383 if (rc) 381 return Failure("kLdrModEnumSymbols failed with rc=%d (%s)", rc, k LdrErrStr(rc));384 return Failure("kLdrModEnumSymbols failed with rc=%d (%s)", rc, kErrName(rc)); 382 385 383 386 … … 488 491 rc = kLdrModGetBits(pMod, pvBits, (KUPTR)pvBits, BasicTestsGetImport, NULL); 489 492 if (rc) 490 return Failure("failed to get image bits, rc=%d (%s)", rc, k LdrErrStr(rc));493 return Failure("failed to get image bits, rc=%d (%s)", rc, kErrName(rc)); 491 494 492 495 /* … … 523 526 rc = kLdrModFixupMapping(pMod, BasicTestsGetImport, NULL); 524 527 if (rc) 525 return Failure("kLdrModFixupMapping (a) failed, rc=%d (%s)", rc, k LdrErrStr(rc));528 return Failure("kLdrModFixupMapping (a) failed, rc=%d (%s)", rc, kErrName(rc)); 526 529 527 530 rc = kLdrModReload(pMod); 528 531 if (rc) 529 return Failure("kLdrModReload (a) failed, rc=%d (%s)", rc, k LdrErrStr(rc));532 return Failure("kLdrModReload (a) failed, rc=%d (%s)", rc, kErrName(rc)); 530 533 531 534 rc = kLdrModReload(pMod); 532 535 if (rc) 533 return Failure("kLdrModReload (b) failed, rc=%d (%s)", rc, k LdrErrStr(rc));536 return Failure("kLdrModReload (b) failed, rc=%d (%s)", rc, kErrName(rc)); 534 537 535 538 rc = kLdrModFixupMapping(pMod, BasicTestsGetImport, NULL); 536 539 if (rc) 537 return Failure("kLdrModFixupMapping (b) failed, rc=%d (%s)", rc, k LdrErrStr(rc));540 return Failure("kLdrModFixupMapping (b) failed, rc=%d (%s)", rc, kErrName(rc)); 538 541 539 542 rc = kLdrModAllocTLS(pMod); 540 543 if (rc) 541 return Failure("kLdrModAllocTLS (a) failed, rc=%d (%s)", rc, k LdrErrStr(rc));544 return Failure("kLdrModAllocTLS (a) failed, rc=%d (%s)", rc, kErrName(rc)); 542 545 kLdrModFreeTLS(pMod); 543 546 544 547 rc = kLdrModAllocTLS(pMod); 545 548 if (rc) 546 return Failure("kLdrModAllocTLS (b) failed, rc=%d (%s)", rc, k LdrErrStr(rc));549 return Failure("kLdrModAllocTLS (b) failed, rc=%d (%s)", rc, kErrName(rc)); 547 550 kLdrModFreeTLS(pMod); 548 551 … … 553 556 rc = BasicTestsSub2(pMod, NULL); 554 557 if (rc) 555 return Failure("BasicTestsSub2 in Map2 failed, rc=%d (%s)", rc, k LdrErrStr(rc));558 return Failure("BasicTestsSub2 in Map2 failed, rc=%d (%s)", rc, kErrName(rc)); 556 559 return 0; 557 560 } … … 568 571 rc = kLdrModMap(pMod); 569 572 if (rc) 570 return Failure("kLdrModMap failed, rc=%d (%s)", rc, k LdrErrStr(rc));573 return Failure("kLdrModMap failed, rc=%d (%s)", rc, kErrName(rc)); 571 574 rc = BasicTestsSubMap2(pMod); 572 575 rc2 = kLdrModUnmap(pMod); 573 576 if (rc2) 574 577 { 575 Failure("kLdrModUnmap failed, rc=%d (%s)", rc2, k LdrErrStr(rc2));578 Failure("kLdrModUnmap failed, rc=%d (%s)", rc2, kErrName(rc2)); 576 579 rc = rc ? rc : rc2; 577 580 } … … 601 604 rc2 = kLdrModClose(pMod); 602 605 if (rc2) 603 Failure("failed to close '%s', rc=%d (%s)", pszFilename, rc, k LdrErrStr(rc));606 Failure("failed to close '%s', rc=%d (%s)", pszFilename, rc, kErrName(rc)); 604 607 if (rc2 && !rc) 605 608 rc = rc2; 606 609 } 607 610 else 608 Failure("Failed to open '%s', rc=%d (%s)", pszFilename, rc, k LdrErrStr(rc));611 Failure("Failed to open '%s', rc=%d (%s)", pszFilename, rc, kErrName(rc)); 609 612 return rc ? 1 : 0; 610 613 }
Note:
See TracChangeset
for help on using the changeset viewer.