Format the error to a message.
| 13 | |
| 14 | // Format the error to a message. |
| 15 | void cobf_format_message(cobf_error err_msg, char* buffer, unsigned int size) |
| 16 | { |
| 17 | // Switching. |
| 18 | switch (err_msg) |
| 19 | { |
| 20 | case cobf_error::COBF_NO_ERROR: strcpy_s(buffer, size, "The operation was successfull."); break; |
| 21 | case cobf_error::COBF_CANNOT_OPEN_FILE: strcpy_s(buffer, size, "Cannot open the file from the disk."); break; |
| 22 | case cobf_error::COBF_CANNOT_CREATE_FILE: strcpy_s(buffer, size, "Cannot create the file to the disk."); break; |
| 23 | case cobf_error::COBF_CANNOT_GET_SIZE: strcpy_s(buffer, size, "Cannot get the file size."); break; |
| 24 | case cobf_error::COBF_CANNOT_READ_FILE: strcpy_s(buffer, size, "Cannot read the file data."); break; |
| 25 | case cobf_error::COBF_INVALID_DOS_HDR: strcpy_s(buffer, size, "The dos header cannot be verified."); break; |
| 26 | case cobf_error::COBF_INVALID_NT_HDRS: strcpy_s(buffer, size, "The nt headers cannot be verified."); break; |
| 27 | case cobf_error::COBF_UNSUPPORTED_PE: strcpy_s(buffer, size, "The PE type is not supported."); break; |
| 28 | case cobf_error::COBF_INVALID_SECTION_HDR: strcpy_s(buffer, size, "The sections header cannot be verified."); break; |
| 29 | case cobf_error::COBF_INVALID_IMPORTS_DIR: strcpy_s(buffer, size, "The imports directory cannot be verified."); break; |
| 30 | case cobf_error::COBF_CANNOT_PARSE_IMPORTS: strcpy_s(buffer, size, "Unable to parse all of the imported symbols."); break; |
| 31 | case cobf_error::COBF_CANNOT_WRITE_FILE: strcpy_s(buffer, size, "Cannot write to the file."); break; |
| 32 | case cobf_error::COBF_CANNOT_CLEAR: strcpy_s(buffer, size, "Cannot close the file handle."); break; |
| 33 | case cobf_error::COBF_CANNOT_CREATE_SECTION: strcpy_s(buffer, size, "Cannot create a new section for the shellcode."); break; |
| 34 | case cobf_error::COBF_CANNOT_ADD_ENTRY: strcpy_s(buffer, size, "Cannot add the entry of the shellcode as a callback."); break; |
| 35 | case cobf_error::COBF_CANNOT_DISABLE_RELOCS: strcpy_s(buffer, size, "Cannot remove the relocations from the PE."); break; |
| 36 | case cobf_error::COBF_INVALID_IAT_SECTION: strcpy_s(buffer, size, "Cannot get the section of the import table."); break; |
| 37 | case cobf_error::COBF_CANNOT_REMOVE_DBG_SYMS:strcpy_s(buffer, size, "Cannot remove the symbols table."); break; |
| 38 | case cobf_error::COBF_MODULE_NOT_FOUND: strcpy_s(buffer, size, "The module was not found."); break; |
| 39 | case cobf_error::COBF_PE_LOADED: strcpy_s(buffer, size, "The PE is already loaded."); break; |
| 40 | case cobf_error::COBF_PE_UNLOADED: strcpy_s(buffer, size, "The PE is already unloaded."); break; |
| 41 | case cobf_error::COBF_SYMS_NOT_FOUND: strcpy_s(buffer, size, "The symbol(s) couldn't be found."); break; |
| 42 | default: strcpy_s(buffer, size, "Unknown error code."); break; |
| 43 | } |
| 44 | }; |
| 45 | |
| 46 | #endif // !UTILS_CPP. |
no outgoing calls
no test coverage detected