Changeset 3579


Ignore:
Timestamp:
Sep 2, 2007, 11:40:41 PM (18 years ago)
Author:
bird
Message:

error code cleanup.

Location:
trunk/kStuff
Files:
3 added
1 deleted
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/kStuff/include/k/kErrors.h

    r3573 r3579  
    7373
    7474/** @name File System and I/O
    75  * @{ */
     75 * @{
     76 */
    7677/** The base of the file system and I/O status cdoes. */
    7778#define KERR_FILE_SYSTEM_AND_IO_BASE                    (KERR_INPUT_BASE + 7)
     
    8485
    8586/** @name   kDbg Specific
    86  * @{ */
     87 * @{
     88 */
    8789/** The base of the kDbg specific status codes. */
    8890#define KDBG_ERR_BASE                                   (KERR_FILE_SYSTEM_AND_IO_BASE + 2)
     
    100102
    101103/** @name   kRdr Specific
    102  * @{ */
     104 * @{
     105 */
    103106/** the base of the kRdr specific status codes. */
    104107#define KRDR_ERR_BASE                                   (KDBG_ERR_BASE + 5)
     
    111114/** @} */
    112115
     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)
    113295/** @}*/
    114296
  • trunk/kStuff/include/k/kLdr.h

    r3578 r3579  
    10131013void kLdrLoadExe(PCKLDREXEARGS pArgs, void *pvOS); /** @todo fix this mess... */
    10141014void 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/** @} */
    12141020
    12151021#ifdef __cplusplus
  • trunk/kStuff/kHlp/Makefile.kmk

    r3578 r3579  
    110110        CRT/kHlpCRTString.cpp \
    111111
     112
    112113# Generate the rules
    113114include $(PATH_KBUILD)/footer.kmk
  • trunk/kStuff/kLdr/Makefile.kmk

    r3578 r3579  
    120120        kLdrDyldOS.c \
    121121        kLdrDyLdSem.c \
    122         kLdrErr.c \
    123122        kLdrMisc.c \
    124123        kLdrMod.c \
     
    136135kLdr_LIBS += \
    137136        $(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)
    142139
    143140#
     
    222219
    223220
    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  
    108108
    109109    ; Error APIs:
    110     _kLdrErrStr
     110    _kErrStr
    111111
    112112
  • trunk/kStuff/kLdr/kLdr-win.def

    r3578 r3579  
    107107
    108108    ; Error APIs:
    109     kLdrErrStr
     109    kErrName
    110110
  • trunk/kStuff/kLdr/kLdrDyld.c

    r3576 r3579  
    253253                          | KLDRDYLD_LOAD_FLAGS_RECURSIVE_INIT
    254254                          | KLDRYDLD_LOAD_FLAGS_SPECIFIC_MODULE))
    255         kldrDyldFailure(KLDR_ERR_INVALID_PARAMETER, "Bad fFlags=%#x", pArgs->fFlags);
     255        kldrDyldFailure(KERR_INVALID_PARAMETER, "Bad fFlags=%#x", pArgs->fFlags);
    256256    if (    pArgs->enmSearch <= KLDRDYLD_SEARCH_INVALID
    257257        ||  pArgs->enmSearch >= KLDRDYLD_SEARCH_END)
    258         kldrDyldFailure(KLDR_ERR_INVALID_PARAMETER, "Bad enmSearch=%d", pArgs->enmSearch);
     258        kldrDyldFailure(KERR_INVALID_PARAMETER, "Bad enmSearch=%d", pArgs->enmSearch);
    259259
    260260    /*
     
    461461 *
    462462 * @returns 0 on success and pszName filled with the name.
    463  * @returns KLDR_ERR_INVALID_HANDLE or KLDR_ERR_BUFFER_OVERFLOW on failure.
     463 * @returns KERR_INVALID_HANDLE or KERR_BUFFER_OVERFLOW on failure.
    464464 * @param   hMod        The module handle.
    465465 * @param   pszName     Where to put the name.
     
    492492 *
    493493 * @returns 0 on success and pszFilename filled with the name.
    494  * @returns KLDR_ERR_INVALID_HANDLE or KLDR_ERR_BUFFER_OVERFLOW on failure.
     494 * @returns KERR_INVALID_HANDLE or KERR_BUFFER_OVERFLOW on failure.
    495495 * @param   hMod            The module handle.
    496496 * @param   pszFilename     Where to put the filename.
     
    523523 *
    524524 * @returns 0 on success and pValue and pfKind set.
    525  * @returns KLDR_ERR_INVALID_HANDLE or KLDR_ERR_SYMBOL_NOT_FOUND on failure.
     525 * @returns KERR_INVALID_HANDLE or KLDR_ERR_SYMBOL_NOT_FOUND on failure.
    526526 * @param   hMod                The module handle.
    527527 * @param   uSymbolOrdinal      The symbol ordinal. This is ignored if pszSymbolName is non-zero.
     
    542542        *pValue = 0;
    543543    if (!pfKind && !pValue)
    544         return KLDR_ERR_INVALID_PARAMETER;
     544        return KERR_INVALID_PARAMETER;
    545545    KLDRDYLD_VALIDATE_HKLDRMOD(hMod);
    546546    K_VALIDATE_OPTIONAL_STRING(pszSymbolName);
     
    10731073 * Records the module.
    10741074 *
    1075  * @return 0 on success, KLDR_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.
    10761076 * @param   pMod        The module to record.
    10771077 */
     
    10871087        void *pvNew = kHlpAlloc(cNew * sizeof(g_papStackMods[0]));
    10881088        if (!pvNew)
    1089             return KLDR_ERR_NO_MEMORY;
     1089            return KERR_NO_MEMORY;
    10901090        kHlpMemCopy(pvNew, pvOld, g_cStackMods * sizeof(g_papStackMods[0]));
    10911091        g_papStackMods = (PPKLDRDYLDMOD)pvNew;
  • trunk/kStuff/kLdr/kLdrDyldFind.c

    r3578 r3579  
    620620        return 0;
    621621    /** @todo deal with return codes properly. */
    622     if (rc >= KLDR_ERR_BASE && rc <= KLDR_ERR_END)
     622    if (rc >= KERR_BASE && rc <= KERR_END)
    623623        return rc;
    624624
     
    772772 * Resolve default search method, prefix and suffix.
    773773 *
    774  * @returns 0 on success, KLDR_ERR_INVALID_PARAMETER on failure.
     774 * @returns 0 on success, KERR_INVALID_PARAMETER on failure.
    775775 * @param   penmSearch  The search method. In/Out.
    776776 * @param   ppszPrefix  The prefix. In/Out.
     
    828828        default:
    829829            KLDRDYLDFIND_ASSERT(!"invalid search method");
    830             return KLDR_ERR_INVALID_PARAMETER;
     830            return KERR_INVALID_PARAMETER;
    831831    }
    832832
  • trunk/kStuff/kLdr/kLdrDyldMod.c

    r3578 r3579  
    182182    {
    183183        kLdrModClose(pRawMod);
    184         rc = KLDR_ERR_NO_MEMORY;
     184        rc = KERR_NO_MEMORY;
    185185    }
    186186    return rc;
     
    762762        pMod->papPrereqs = (PPKLDRDYLDMOD)kHlpAllocZ(sizeof(pMod->papPrereqs[0]) * cPrereqs);
    763763        if (!pMod->papPrereqs)
    764             return KLDR_ERR_NO_MEMORY;
     764            return KERR_NO_MEMORY;
    765765        pMod->cPrereqs = cPrereqs;
    766766    }
     
    12241224 * Gets the module name.
    12251225 *
    1226  * @returns 0 on success, KLDR_ERR_BUFFER_OVERFLOW on failure.
     1226 * @returns 0 on success, KERR_BUFFER_OVERFLOW on failure.
    12271227 * @param   pMod            The module.
    12281228 * @param   pszName         Where to store the name.
     
    12371237        pszName[cch - 1] = '\0';
    12381238    }
    1239     return cchName <= pMod->pMod->cchName ? KLDR_ERR_BUFFER_OVERFLOW : 0;
     1239    return cchName <= pMod->pMod->cchName ? KERR_BUFFER_OVERFLOW : 0;
    12401240}
    12411241
     
    12441244 * Gets the module filename.
    12451245 *
    1246  * @returns 0 on success, KLDR_ERR_BUFFER_OVERFLOW on failure.
     1246 * @returns 0 on success, KERR_BUFFER_OVERFLOW on failure.
    12471247 * @param   pMod            The module.
    12481248 * @param   pszFilename     Where to store the filename.
     
    12571257        pszFilename[cch - 1] = '\0';
    12581258    }
    1259     return cchFilename <= pMod->pMod->cchFilename ? KLDR_ERR_BUFFER_OVERFLOW : 0;
     1259    return cchFilename <= pMod->pMod->cchFilename ? KERR_BUFFER_OVERFLOW : 0;
    12601260}
    12611261
  • trunk/kStuff/kLdr/kLdrInternal.h

    r3578 r3579  
    329329            ||  (hMod)->u32MagicTail != KLDRDYMOD_MAGIC) \
    330330        { \
    331             return KLDR_ERR_INVALID_HANDLE; \
     331            return KERR_INVALID_HANDLE; \
    332332        } \
    333333    } while (0)
  • trunk/kStuff/kLdr/kLdrMisc.c

    r3573 r3579  
    5959        case KLDRARCH_X86_16:
    6060            if (enmCpu < KLDRCPU_FIRST_X86_16 || enmCpu > KLDRCPU_LAST_X86_16)
    61                 return KLDR_ERR_INVALID_PARAMETER;
     61                return KERR_INVALID_PARAMETER;
    6262
    6363            /* intel? */
     
    8383        case KLDRARCH_X86_32:
    8484            if (enmCpu < KLDRCPU_FIRST_X86_32 || enmCpu > KLDRCPU_LAST_X86_32)
    85                 return KLDR_ERR_INVALID_PARAMETER;
     85                return KERR_INVALID_PARAMETER;
    8686
    8787            /* blend? */
     
    111111        case KLDRARCH_AMD64:
    112112            if (enmCpu < KLDRCPU_FIRST_AMD64 || enmCpu > KLDRCPU_LAST_AMD64)
    113                 return KLDR_ERR_INVALID_PARAMETER;
     113                return KERR_INVALID_PARAMETER;
    114114
    115115            /* blend? */
  • trunk/kStuff/kLdr/kLdrMod.c

    r3578 r3579  
    7070/** Return / crash validation of a module argument. */
    7171#define KLDRMOD_VALIDATE(pMod) \
    72     KLDRMOD_VALIDATE_EX(pMod, KLDR_ERR_INVALID_PARAMETER)
     72    KLDRMOD_VALIDATE_EX(pMod, KERR_INVALID_PARAMETER)
    7373
    7474/** Return / crash validation of a module argument. */
     
    263263    KLDRMOD_VALIDATE(pMod);
    264264    if (!puValue && !pfKind)
    265         return KLDR_ERR_INVALID_PARAMETER;
     265        return KERR_INVALID_PARAMETER;
    266266    if (puValue)
    267267        *puValue = 0;
     
    300300 *
    301301 * @returns 0 and name in pszName on success.
    302  *          On buffer overruns KLDR_ERR_BUFFER_OVERFLOW will be returned.
     302 *          On buffer overruns KERR_BUFFER_OVERFLOW will be returned.
    303303 *          On other failures and appropriate error code is returned.
    304304 * @param   pMod            The module.
     
    421421    KLDRMOD_VALIDATE(pMod);
    422422    if (!pAddrRsrc && !pcbRsrc)
    423         return KLDR_ERR_INVALID_PARAMETER;
     423        return KERR_INVALID_PARAMETER;
    424424    if (pAddrRsrc)
    425425        *pAddrRsrc = NIL_KLDRADDR;
  • trunk/kStuff/kLdr/kLdrModLX.c

    r3578 r3579  
    273273    pModLX = (PKLDRMODLX)kHlpAlloc(cb);
    274274    if (!pModLX)
    275         return KLDR_ERR_NO_MEMORY;
     275        return KERR_NO_MEMORY;
    276276    *ppModLX = pModLX;
    277277
     
    938938    pv = kHlpAlloc(pModLX->Hdr.e32_fixupsize);
    939939    if (!pv)
    940         return KLDR_ERR_NO_MEMORY;
     940        return KERR_NO_MEMORY;
    941941
    942942    off = pModLX->Hdr.e32_objtab + pModLX->Hdr.e32_ldrsize;
     
    12161216        if (cchName)
    12171217            pszName[cchName - 1] = '\0';
    1218         rc = KLDR_ERR_BUFFER_OVERFLOW;
     1218        rc = KERR_BUFFER_OVERFLOW;
    12191219    }
    12201220
  • trunk/kStuff/kLdr/kLdrModMachO.c

    r3578 r3579  
    280280    pbLoadCommands = kHlpAlloc(s.Hdr32.sizeofcmds);
    281281    if (!pbLoadCommands)
    282         return KLDR_ERR_NO_MEMORY;
     282        return KERR_NO_MEMORY;
    283283    rc = kRdrRead(pRdr, pbLoadCommands, s.Hdr32.sizeofcmds,
    284284                        s.Hdr32.magic == IMAGE_MACHO32_SIGNATURE
     
    305305    pModMachO = (PKLDRMODMACHO)kHlpAlloc(cb);
    306306    if (!pModMachO)
    307         return KLDR_ERR_NO_MEMORY;
     307        return KERR_NO_MEMORY;
    308308    *ppModMachO = pModMachO;
    309309    pModMachO->pbLoadCommands = pbLoadCommands;
     
    639639
    640640                        default:
    641                             return KLDR_ERR_INVALID_PARAMETER;
     641                            return KERR_INVALID_PARAMETER;
    642642                    }
    643643
     
    925925
    926926                        default:
    927                             return KLDR_ERR_INVALID_PARAMETER;
     927                            return KERR_INVALID_PARAMETER;
    928928                    }
    929929
     
    21402140        if (cbSyms / cbSym != pModMachO->cSymbols)
    21412141            return KLDR_ERR_SIZE_OVERFLOW;
    2142         rc = KLDR_ERR_NO_MEMORY;
     2142        rc = KERR_NO_MEMORY;
    21432143        pvSyms = kHlpAlloc(cbSyms);
    21442144        if (pvSyms)
     
    22212221    paFixups = (macho_relocation_info_t *)kHlpAlloc(cbFixups);
    22222222    if (!paFixups)
    2223         return KLDR_ERR_NO_MEMORY;
     2223        return KERR_NO_MEMORY;
    22242224
    22252225    /* read the fixups. */
  • trunk/kStuff/kLdr/kLdrModNative.c

    r3578 r3579  
    305305    pModNative = (PKLDRMODNATIVE)kHlpAlloc(cb);
    306306    if (!pModNative)
    307         return KLDR_ERR_NO_MEMORY;
     307        return KERR_NO_MEMORY;
    308308
    309309    /* KLDRMOD */
     
    766766        if (cchName)
    767767            pszName[cchName - 1] = '\0';
    768         rc = KLDR_ERR_BUFFER_OVERFLOW;
     768        rc = KERR_BUFFER_OVERFLOW;
    769769    }
    770770
  • trunk/kStuff/kLdr/kLdrModPE.c

    r3578 r3579  
    205205    pModPE = (PKLDRMODPE)kHlpAlloc(cb);
    206206    if (!pModPE)
    207         return KLDR_ERR_NO_MEMORY;
     207        return KERR_NO_MEMORY;
    208208    *ppModPE = pModPE;
    209209
     
    10501050        if (cchName)
    10511051            pszName[cchName - 1] = '\0';
    1052         rc = KLDR_ERR_BUFFER_OVERFLOW;
     1052        rc = KERR_BUFFER_OVERFLOW;
    10531053    }
    10541054
  • trunk/kStuff/kLdr/testcase/tst-3-driver.c

    r2967 r3579  
    120120    rc = kLdrModOpen(pszFile, &pMod);
    121121    if (rc)
    122         return Failure("kLdrModOpen(%s,) -> %#d (%s)\n", pszFile, rc, kLdrErrStr(rc));
     122        return Failure("kLdrModOpen(%s,) -> %#d (%s)\n", pszFile, rc, kErrName(rc));
    123123
    124124    /* get bits. */
     
    163163                        }
    164164                        else
    165                             Failure("kLdrModRelocateBits(,,, + 0x22000,,,) -> %#x (%s)\n", rc, kLdrErrStr(rc));
     165                            Failure("kLdrModRelocateBits(,,, + 0x22000,,,) -> %#x (%s)\n", rc, kErrName(rc));
    166166                    }
    167167                    else
    168                         Failure("kLdrModRelocateBits(,, + 0x22000,,,,) -> %#x (%s)\n", rc, kLdrErrStr(rc));
     168                        Failure("kLdrModRelocateBits(,, + 0x22000,,,,) -> %#x (%s)\n", rc, kErrName(rc));
    169169                }
    170170                else
     
    172172            }
    173173            else
    174                 Failure("kLdrModQuerySymbol -> %#x (%s)\n", rc, kLdrErrStr(rc));
     174                Failure("kLdrModQuerySymbol -> %#x (%s)\n", rc, kErrName(rc));
    175175        }
    176176        else
    177             Failure("kLdrModGetBits -> %#x (%s)\n", rc, kLdrErrStr(rc));
     177            Failure("kLdrModGetBits -> %#x (%s)\n", rc, kErrName(rc));
    178178        free(pvBits);
    179179    }
     
    184184    rc = kLdrModClose(pMod);
    185185    if (rc)
    186         Failure("kLdrModOpen(%s,) -> %#x (%s)\n", pszFile, rc, kLdrErrStr(rc));
     186        Failure("kLdrModOpen(%s,) -> %#x (%s)\n", pszFile, rc, kErrName(rc));
    187187    return 0;
    188188}
  • trunk/kStuff/kLdr/tstkLdrMod.c

    r3571 r3579  
    3030*******************************************************************************/
    3131#include <k/kLdr.h>
     32#include <k/kErr.h>
     33#include <k/kErrors.h>
     34
    3235#include <stdarg.h>
    3336#include <stdio.h>
     
    116119    rc = kLdrModGetBits(pMod, pvBits2, (KUPTR)pvBits, BasicTestsGetImport, NULL);
    117120    if (rc)
    118         return Failure("failed to get image bits, rc=%d (%s) (a)", rc, kLdrErrStr(rc));
     121        return Failure("failed to get image bits, rc=%d (%s) (a)", rc, kErrName(rc));
    119122    if (TestMemComp(pvBits2, pvBits, cbImage))
    120123        return Failure("relocation test failed, mismatching bits (a)");
     
    125128    rc = kLdrModRelocateBits(pMod, pvBits2, 0x1000, (KUPTR)pvBits, BasicTestsGetImport, NULL);
    126129    if (rc)
    127         return Failure("failed to relocate, rc=%d (%s) (b1)", rc, kLdrErrStr(rc));
     130        return Failure("failed to relocate, rc=%d (%s) (b1)", rc, kErrName(rc));
    128131    rc = kLdrModRelocateBits(pMod, pvBits2, (KUPTR)pvBits, 0x1000, BasicTestsGetImport, NULL);
    129132    if (rc)
    130         return Failure("failed to relocate, rc=%d (%s) (b2)", rc, kLdrErrStr(rc));
     133        return Failure("failed to relocate, rc=%d (%s) (b2)", rc, kErrName(rc));
    131134    if (TestMemComp(pvBits2, pvBits, cbImage))
    132135        return Failure("relocation test failed, mismatching bits (b)");
     
    138141    rc = kLdrModRelocateBits(pMod, pvBits, 0x1000000, (KUPTR)pvBits, BasicTestsGetImport, NULL);
    139142    if (rc)
    140         return Failure("failed to relocate, rc=%d (%s) (c1)", rc, kLdrErrStr(rc));
     143        return Failure("failed to relocate, rc=%d (%s) (c1)", rc, kErrName(rc));
    141144    memset(pvBits2, 0xfe, cbImage);
    142145    rc = kLdrModGetBits(pMod, pvBits2, 0x1000000, BasicTestsGetImport, NULL);
    143146    if (rc)
    144         return Failure("failed to get image bits, rc=%d (%s) (c1)", rc, kLdrErrStr(rc));
     147        return Failure("failed to get image bits, rc=%d (%s) (c1)", rc, kErrName(rc));
    145148    if (TestMemComp(pvBits2, pvBits, cbImage))
    146149        return Failure("relocation test failed, mismatching bits (c1)");
     
    149152    rc = kLdrModRelocateBits(pMod, pvBits, ~(KUPTR)0x1010000, 0x1000000, BasicTestsGetImport, NULL);
    150153    if (rc)
    151         return Failure("failed to relocate, rc=%d (%s) (c2)", rc, kLdrErrStr(rc));
     154        return Failure("failed to relocate, rc=%d (%s) (c2)", rc, kErrName(rc));
    152155    memset(pvBits2, 0xef, cbImage);
    153156    rc = kLdrModGetBits(pMod, pvBits2, ~(KUPTR)0x1010000, BasicTestsGetImport, NULL);
    154157    if (rc)
    155         return Failure("failed to get image bits, rc=%d (%s) (c2)", rc, kLdrErrStr(rc));
     158        return Failure("failed to get image bits, rc=%d (%s) (c2)", rc, kErrName(rc));
    156159    if (TestMemComp(pvBits2, pvBits, cbImage))
    157160        return Failure("relocation test failed, mismatching bits (c2)");
     
    160163    rc = kLdrModRelocateBits(pMod, pvBits, MY_BASEADDRESS, ~(KUPTR)0x1010000, BasicTestsGetImport, NULL);
    161164    if (rc)
    162         return Failure("failed to relocate, rc=%d (%s) (c3)", rc, kLdrErrStr(rc));
     165        return Failure("failed to relocate, rc=%d (%s) (c3)", rc, kErrName(rc));
    163166    memset(pvBits2, 0xef, cbImage);
    164167    rc = kLdrModGetBits(pMod, pvBits2, MY_BASEADDRESS, BasicTestsGetImport, NULL);
    165168    if (rc)
    166         return Failure("failed to get image bits, rc=%d (%s) (c3)", rc, kLdrErrStr(rc));
     169        return Failure("failed to get image bits, rc=%d (%s) (c3)", rc, kErrName(rc));
    167170    if (TestMemComp(pvBits2, pvBits, cbImage))
    168171        return Failure("relocation test failed, mismatching bits (c3)");
     
    171174    rc = kLdrModRelocateBits(pMod, pvBits, ~(KUPTR)0 / 2 - 0x10000, MY_BASEADDRESS, BasicTestsGetImport, NULL);
    172175    if (rc)
    173         return Failure("failed to relocate, rc=%d %(s) (c4)", rc, kLdrErrStr(rc));
     176        return Failure("failed to relocate, rc=%d %(s) (c4)", rc, kErrName(rc));
    174177    memset(pvBits2, 0xdc, cbImage);
    175178    rc = kLdrModGetBits(pMod, pvBits2, ~(KUPTR)0 / 2 - 0x10000, BasicTestsGetImport, NULL);
    176179    if (rc)
    177         return Failure("failed to get image bits, rc=%d (%s) (c4)", rc, kLdrErrStr(rc));
     180        return Failure("failed to get image bits, rc=%d (%s) (c4)", rc, kErrName(rc));
    178181    if (TestMemComp(pvBits2, pvBits, cbImage))
    179182        return Failure("relocation test failed, mismatching bits (c4)");
     
    182185    rc = kLdrModRelocateBits(pMod, pvBits, (KUPTR)pvBits, ~(KUPTR)0 / 2 - 0x10000, BasicTestsGetImport, NULL);
    183186    if (rc)
    184         return Failure("failed to relocate, rc=%d (%s) (c5)", rc, kLdrErrStr(rc));
     187        return Failure("failed to relocate, rc=%d (%s) (c5)", rc, kErrName(rc));
    185188    memset(pvBits2, 0xcd, cbImage);
    186189    rc = kLdrModGetBits(pMod, pvBits2, (KUPTR)pvBits, BasicTestsGetImport, NULL);
    187190    if (rc)
    188         return Failure("failed to get image bits, rc=%d (%s) (c5)", rc, kLdrErrStr(rc));
     191        return Failure("failed to get image bits, rc=%d (%s) (c5)", rc, kErrName(rc));
    189192    if (TestMemComp(pvBits2, pvBits, cbImage))
    190193        return Failure("relocation test failed, mismatching bits (c5)");
     
    217220                                &uValue2, &fKind2);
    218221        if (rc)
    219             return Failure("Couldn't find symbol %#x (%.*s) by ordinal. rc=%d (%s)", iSymbol, cchSymbol, pchSymbol, rc, kLdrErrStr(rc));
     222            return Failure("Couldn't find symbol %#x (%.*s) by ordinal. rc=%d (%s)", iSymbol, cchSymbol, pchSymbol, rc, kErrName(rc));
    220223        if (uValue != uValue2)
    221224            return Failure("Symbol %#x (%.*s): Value mismatch %016" PRI_KLDRADDR " != %016" PRI_KLDRADDR " (enum!=query/ord)  pvBits=%p",
     
    233236                                NULL, NULL, &uValue2, &fKind2);
    234237        if (rc)
    235             return Failure("Couldn't find symbol %#x (%.*s) by name. rc=%d (%s)", iSymbol, cchSymbol, pchSymbol, rc, kLdrErrStr(rc));
     238            return Failure("Couldn't find symbol %#x (%.*s) by name. rc=%d (%s)", iSymbol, cchSymbol, pchSymbol, rc, kErrName(rc));
    236239        if (uValue != uValue2)
    237240            return Failure("Symbol %#x (%.*s): Value mismatch %016" PRI_KLDRADDR " != %016" PRI_KLDRADDR " (enum!=query/name) pvBits=%p",
     
    294297        rc = kLdrModGetImport(pMod, pvBits, i, szImportModule, sizeof(szImportModule));
    295298        if (rc)
    296             return Failure("failed to get import module name, rc=%d (%s). (%.260s)", rc, kLdrErrStr(rc), szImportModule);
     299            return Failure("failed to get import module name, rc=%d (%s). (%.260s)", rc, kErrName(rc), szImportModule);
    297300        printf("import #%d: '%s'\n", i, szImportModule);
    298301    }
     
    307310    rc = kLdrModGetStackInfo(pMod, pvBits, MY_BASEADDRESS, &StackInfo);
    308311    if (rc)
    309         return Failure("kLdrModGetStackInfo failed with rc=%d (%s)", rc, kLdrErrStr(rc));
     312        return Failure("kLdrModGetStackInfo failed with rc=%d (%s)", rc, kErrName(rc));
    310313    printf("Stack: Address=%016" PRI_KLDRADDR "   LinkAddress=%016" PRI_KLDRADDR "\n"
    311314           "       cbStack=%016" PRI_KLDRSIZE " cbStackThread=%016" PRI_KLDRSIZE "\n",
     
    326329    rc = kLdrModQueryMainEntrypoint(pMod, pvBits, MY_BASEADDRESS, &MainEPAddress);
    327330    if (rc)
    328         return Failure("kLdrModQueryMainEntrypoint failed with rc=%d (%s)", rc, kLdrErrStr(rc));
     331        return Failure("kLdrModQueryMainEntrypoint failed with rc=%d (%s)", rc, kErrName(rc));
    329332    printf("Entrypoint: %016" PRI_KLDRADDR "\n", MainEPAddress);
    330333    if (MainEPAddress == ~(KLDRADDR)42)
     
    344347        printf("NO Debugger Information\n");
    345348    else
    346         return Failure("kLdrModHasDbgInfo failed with rc=%d (%s)", rc, kLdrErrStr(rc));
     349        return Failure("kLdrModHasDbgInfo failed with rc=%d (%s)", rc, kErrName(rc));
    347350    rc = kLdrModEnumDbgInfo(pMod, pvBits, BasicTestEnumDbgInfoCallback, NULL);
    348351    if (rc)
    349         return Failure("kLdrModEnumDbgInfo failed with rc=%d (%s)", rc, kLdrErrStr(rc));
     352        return Failure("kLdrModEnumDbgInfo failed with rc=%d (%s)", rc, kErrName(rc));
    350353
    351354
     
    379382    rc = kLdrModEnumSymbols(pMod, pvBits, MY_BASEADDRESS, 0, BasicTestsEnumSymCallback, pvBits);
    380383    if (rc)
    381         return Failure("kLdrModEnumSymbols failed with rc=%d (%s)", rc, kLdrErrStr(rc));
     384        return Failure("kLdrModEnumSymbols failed with rc=%d (%s)", rc, kErrName(rc));
    382385
    383386
     
    488491    rc = kLdrModGetBits(pMod, pvBits, (KUPTR)pvBits, BasicTestsGetImport, NULL);
    489492    if (rc)
    490         return Failure("failed to get image bits, rc=%d (%s)", rc, kLdrErrStr(rc));
     493        return Failure("failed to get image bits, rc=%d (%s)", rc, kErrName(rc));
    491494
    492495    /*
     
    523526    rc = kLdrModFixupMapping(pMod, BasicTestsGetImport, NULL);
    524527    if (rc)
    525         return Failure("kLdrModFixupMapping (a) failed, rc=%d (%s)", rc, kLdrErrStr(rc));
     528        return Failure("kLdrModFixupMapping (a) failed, rc=%d (%s)", rc, kErrName(rc));
    526529
    527530    rc = kLdrModReload(pMod);
    528531    if (rc)
    529         return Failure("kLdrModReload (a) failed, rc=%d (%s)", rc, kLdrErrStr(rc));
     532        return Failure("kLdrModReload (a) failed, rc=%d (%s)", rc, kErrName(rc));
    530533
    531534    rc = kLdrModReload(pMod);
    532535    if (rc)
    533         return Failure("kLdrModReload (b) failed, rc=%d (%s)", rc, kLdrErrStr(rc));
     536        return Failure("kLdrModReload (b) failed, rc=%d (%s)", rc, kErrName(rc));
    534537
    535538    rc = kLdrModFixupMapping(pMod, BasicTestsGetImport, NULL);
    536539    if (rc)
    537         return Failure("kLdrModFixupMapping (b) failed, rc=%d (%s)", rc, kLdrErrStr(rc));
     540        return Failure("kLdrModFixupMapping (b) failed, rc=%d (%s)", rc, kErrName(rc));
    538541
    539542    rc = kLdrModAllocTLS(pMod);
    540543    if (rc)
    541         return Failure("kLdrModAllocTLS (a) failed, rc=%d (%s)", rc, kLdrErrStr(rc));
     544        return Failure("kLdrModAllocTLS (a) failed, rc=%d (%s)", rc, kErrName(rc));
    542545    kLdrModFreeTLS(pMod);
    543546
    544547    rc = kLdrModAllocTLS(pMod);
    545548    if (rc)
    546         return Failure("kLdrModAllocTLS (b) failed, rc=%d (%s)", rc, kLdrErrStr(rc));
     549        return Failure("kLdrModAllocTLS (b) failed, rc=%d (%s)", rc, kErrName(rc));
    547550    kLdrModFreeTLS(pMod);
    548551
     
    553556    rc = BasicTestsSub2(pMod, NULL);
    554557    if (rc)
    555         return Failure("BasicTestsSub2 in Map2 failed, rc=%d (%s)", rc, kLdrErrStr(rc));
     558        return Failure("BasicTestsSub2 in Map2 failed, rc=%d (%s)", rc, kErrName(rc));
    556559    return 0;
    557560}
     
    568571    rc = kLdrModMap(pMod);
    569572    if (rc)
    570         return Failure("kLdrModMap failed, rc=%d (%s)", rc, kLdrErrStr(rc));
     573        return Failure("kLdrModMap failed, rc=%d (%s)", rc, kErrName(rc));
    571574    rc = BasicTestsSubMap2(pMod);
    572575    rc2 = kLdrModUnmap(pMod);
    573576    if (rc2)
    574577    {
    575         Failure("kLdrModUnmap failed, rc=%d (%s)", rc2, kLdrErrStr(rc2));
     578        Failure("kLdrModUnmap failed, rc=%d (%s)", rc2, kErrName(rc2));
    576579        rc = rc ? rc : rc2;
    577580    }
     
    601604        rc2 = kLdrModClose(pMod);
    602605        if (rc2)
    603             Failure("failed to close '%s', rc=%d (%s)", pszFilename, rc, kLdrErrStr(rc));
     606            Failure("failed to close '%s', rc=%d (%s)", pszFilename, rc, kErrName(rc));
    604607        if (rc2 && !rc)
    605608            rc = rc2;
    606609    }
    607610    else
    608         Failure("Failed to open '%s', rc=%d (%s)", pszFilename, rc, kLdrErrStr(rc));
     611        Failure("Failed to open '%s', rc=%d (%s)", pszFilename, rc, kErrName(rc));
    609612    return rc ? 1 : 0;
    610613}
Note: See TracChangeset for help on using the changeset viewer.