mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
FIX: 'hf mf cload' - showing helptext instead of loading file.
Added support for easy loading of bin/eml files in this patch aswell.
This commit is contained in:
parent
d2f3a9fd68
commit
6a21df3443
3 changed files with 377 additions and 269 deletions
|
@ -48,10 +48,13 @@
|
|||
#include <stdarg.h>
|
||||
#include "../ui.h"
|
||||
|
||||
int fileExists(const char *filename);
|
||||
|
||||
/**
|
||||
* @brief Utility function to save data to a binary file. This method takes a preferred name, but if that
|
||||
* file already exists, it tries with another name until it finds something suitable.
|
||||
* E.g. dumpdata-15.txt
|
||||
*
|
||||
* @param preferredName
|
||||
* @param suffix the file suffix. Leave out the ".".
|
||||
* @param data The binary data to write to the file
|
||||
|
@ -61,9 +64,10 @@
|
|||
extern int saveFile(const char *preferredName, const char *suffix, const void* data, size_t datalen);
|
||||
|
||||
/**
|
||||
* @brief Utility function to save data to a textfile. This method takes a preferred name, but if that
|
||||
* @brief Utility function to save data to a textfile (EML). This method takes a preferred name, but if that
|
||||
* file already exists, it tries with another name until it finds something suitable.
|
||||
* E.g. dumpdata-15.txt
|
||||
*
|
||||
* @param preferredName
|
||||
* @param suffix the file suffix. Leave out the ".".
|
||||
* @param data The binary data to write to the file
|
||||
|
@ -72,16 +76,55 @@ extern int saveFile(const char *preferredName, const char *suffix, const void* d
|
|||
* @return 0 for ok, 1 for failz
|
||||
*/
|
||||
extern int saveFileEML(const char *preferredName, const char *suffix, uint8_t* data, size_t datalen, size_t blocksize);
|
||||
/**
|
||||
* @brief Utility function to save load binary data from a a file. This method takes a filename,
|
||||
* Should only be used for fixed-size binary files
|
||||
* @param fileName the name of the file
|
||||
* @param data a buffer to place data in
|
||||
* @param datalen the length of the data/data.
|
||||
* @return
|
||||
*/
|
||||
|
||||
int fileExists(const char *filename);
|
||||
/** STUB
|
||||
* @brief Utility function to save JSON data to a file. This method takes a preferred name, but if that
|
||||
* file already exists, it tries with another name until it finds something suitable.
|
||||
* E.g. dumpdata-15.json
|
||||
*
|
||||
* @param preferredName
|
||||
* @param suffix the file suffix. Leave out the ".".
|
||||
* @param data The binary data to write to the file
|
||||
* @param datalen the length of the data
|
||||
* @return 0 for ok, 1 for failz
|
||||
*/
|
||||
extern int saveFileJSON(const char *preferredName, const char *suffix, uint8_t* data, size_t datalen);
|
||||
|
||||
/** STUB
|
||||
* @brief Utility function to load data from a binary file. This method takes a preferred name.
|
||||
* E.g. dumpdata-15.bin
|
||||
*
|
||||
* @param preferredName
|
||||
* @param suffix the file suffix. Leave out the ".".
|
||||
* @param data The data array to store the loaded bytes from file
|
||||
* @param datalen the number of bytes loaded from file
|
||||
* @return 0 for ok, 1 for failz
|
||||
*/
|
||||
extern int loadFile(const char *preferredName, const char *suffix, void* data, size_t* datalen);
|
||||
|
||||
/**
|
||||
* @brief Utility function to load data from a textfile (EML). This method takes a preferred name.
|
||||
* E.g. dumpdata-15.txt
|
||||
*
|
||||
* @param preferredName
|
||||
* @param suffix the file suffix. Leave out the ".".
|
||||
* @param data The data array to store the loaded bytes from file
|
||||
* @param datalen the number of bytes loaded from file
|
||||
* @return 0 for ok, 1 for failz
|
||||
*/
|
||||
extern int loadFileEML(const char *preferredName, const char *suffix, void* data, size_t* datalen);
|
||||
|
||||
/** STUB
|
||||
* @brief Utility function to load data from a JSON textfile. This method takes a preferred name.
|
||||
* E.g. dumpdata-15.json
|
||||
*
|
||||
* @param preferredName
|
||||
* @param suffix the file suffix. Leave out the ".".
|
||||
* @param data The data array to store the loaded bytes from file
|
||||
* @param datalen the number of bytes loaded from file
|
||||
* @return 0 for ok, 1 for failz
|
||||
*/
|
||||
extern int loadFileJSON(const char *preferredName, const char *suffix, void* data, size_t* datalen);
|
||||
|
||||
#define PrintAndLogDevice(level, format, args...) PrintAndLogEx(level, format , ## args)
|
||||
#else
|
||||
|
@ -98,7 +141,4 @@ int fileExists(const char *filename);
|
|||
|
||||
#endif //ON_DEVICE
|
||||
|
||||
|
||||
//void PrintAndLogDevice(logLevel_t level, char *fmt, ...);
|
||||
|
||||
#endif // FILEUTILS_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue