Changeset 3579 for trunk/kStuff/include/k/kLdr.h
- Timestamp:
- Sep 2, 2007, 11:40:41 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.