Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // -----------
- // Error codes
- // -----------
- #define STATUS_OK 0
- // --------------
- // Hash functions
- // --------------
- #define HASH_MD5 0
- #define HASH_SHA1 1
- #define HASH_SHA256 2
- // -------------------------------------
- // Return codes of the callback function
- // -------------------------------------
- #define CALLBACK_STOP 0
- #define CALLBACK_CONTINUE 1
- //--------------------
- // Some HIVE sub-paths
- //--------------------
- #define HIVE_HKLM_SAM "/System32/Config/Sam"
- #define HIVE_HKLM_SECURITY "/System32/Config/Security"
- #define HIVE_HKLM_SOFTWARE "/System32/Config/Software"
- #define HIVE_HKLM_SYSTEM "/System32/Config/System"
- #define HIVE_HKU_DEFAULT "/System32/Config/Default"
- // ----------------
- // Access functions
- // ----------------
- // Returns the size in bytes of the given file
- // name -- the path of the file
- // size -- on success receives the size of the file in bytes
- // returns STATUS_OK on success and error on failure
- int GetFileSize(char *name, uint64_t *size);
- // Reads a portion of a file
- // name -- the path of the file
- // pos -- the first byte to be read
- // buffer -- the buffer in which the read bytes should be stored
- // size -- the number of bytes to be read
- // returns STATUS_OK on success and error on failure
- int ReadFile(char *name, uint64_t pos, void *buffer, uint64_t size);
- // Returns the size in bytes of the given key's value
- // hive -- the path of the hive
- // name -- the path of the key
- // size -- on success receives the size of the key's value in bytes
- // returns STATUS_OK on success and error on failure
- int GetRegistryValueSize(char *hive, char *name, uint64_t *size);
- // Reads a portion of a key's value
- // hive -- the path of the hive
- // name -- the path of the key
- // pos -- the first byte to be read
- // buffer -- the buffer in which the read bytes should be stored
- // size -- the number of bytes to be read
- // returns STATUS_OK on success and error on failure
- int ReadRegistryValue(char *hive, char *name, uint64_t pos, void *buffer, uint64_t size);
- // ---------------------------
- // Callback function signature
- // ---------------------------
- // This function is called on each matched entry during a search
- // context -- the context that was passed to the search function
- // name -- the path of the entry (file or registry key) found
- // The function returns CALLBACK_STOP to terminate the search and CALLBACK_CONTINUE to continue
- int (*FindCallback)(void *context, char *name);
- // ----------------
- // Search functions
- // ----------------
- // Searches for the given regular expression in the [first,last) range of sectors
- // dev -- the device path to search on
- // pattern -- the pattern to search for
- // first, last -- the range to search for including first but excluding last
- // exists -- set to zero if the pattern was not found, set to non-zero otherwise
- // returns STATUS_OK on success and error on failure
- int ExistsInSectors(char *dev, char *pattern, uint64_t first, uint64_t last, int *exists);
- // Searches for files by name in the given directory and recursively
- // dir -- the directory to search in
- // pattern -- the pattern to search for
- // callback -- the function to be called on a match
- // context -- the context to be passed to the callback function
- // returns STATUS_OK on success and error on failure
- int FindFilesByName(char *dir, char *pattern, FindCallback callback, void *context);
- // Searches for files by name in the given directory and recursively
- // dir -- the directory to search in
- // pattern -- the pattern to search for
- // callback -- the function to be called on a match
- // context -- the context to be passed to the callback function
- // returns STATUS_OK on success and error on failure
- int FindFilesByHash(char *dir, char *hash, int hashType, FindCallback callback, void *context);
- // Searches for files by contents in the given directory and recursively
- // dir -- the directory to search in
- // pattern -- the pattern to search for
- // callback -- the function to be called on a match
- // context -- the context to be passed to the callback function
- // returns STATUS_OK on success and error on failure
- int FindFilesByContents(char *dir, char *pattern, FindCallback callback, void *context);
- // Searches for registry keys by name in the given hive
- // hive -- the path of the hive to search in (should be a concatenation of the mount point and a hive sub-path)
- // pattern -- the pattern to search for in the full path of the key
- // callback -- the function to be called on a match
- // context -- the context to be passed to the callback function
- // returns STATUS_OK on success and error on failure
- int FindRegistryByKey(char *hive, char *pattern, FindCallback callback, void *context);
- // Searches for registry values in the given hive
- // hive -- the path of the hive to search in (should be a concatenation of the mount point and a hive sub-path)
- // pattern -- the pattern to search for
- // callback -- the function to be called on a match
- // context -- the context to be passed to the callback function
- // returns STATUS_OK on success and error on failure
- int FindRegistryByValue(char *hive, char *pattern, FindCallback callback, void *context);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement