Skip to content

Commit

Permalink
added error checks
Browse files Browse the repository at this point in the history
  • Loading branch information
yehoudie committed Dec 11, 2023
1 parent 8daea03 commit 3c3d323
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ Calculates the hash sum of files or files in folders.
The hash sum will be md5, sha128 or sha256 depending on the executed binary.

### version
1.0.3
Last changed: 17.04.2023
1.0.5
Last changed: 11.12.2023


### build
Expand Down
14 changes: 8 additions & 6 deletions src/hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@

HashCtxt ctxt;

#define BIN_VS "1.0.4"
#define BIN_LC "17.05.2023"
#define BIN_VS "1.0.5"
#define BIN_LC "11.12.2023"


int compare(int argc, WCHAR** argv);
void printColored(CHAR* value, UINT16 attributes);

void fileCB(wchar_t* file);
int runList(int argc, WCHAR** argv);

void printVersion()
Expand Down Expand Up @@ -243,7 +244,6 @@ int runList(int argc, WCHAR** argv)
WCHAR* base_name = NULL;
int files_i = 1;
int i;
UINT8 hash_bytes[HASH_BYTES_LN];

for ( i = files_i; i < argc; i++ )
{
Expand All @@ -261,8 +261,7 @@ int runList(int argc, WCHAR** argv)

if ( ntFileExists(full_path) )
{
s = hashFileC(full_path, hash_bytes, (UINT16)ctxt.HashSize, &ctxt);
lPrintHash(hash_bytes, ctxt.HashSize, full_path, HASH_TYPE_STR);
fileCB(full_path);
}
else if ( ntDirExists(full_path) )
{
Expand All @@ -281,8 +280,11 @@ int runList(int argc, WCHAR** argv)
void fileCB(wchar_t* file)
{
UINT8 hash_bytes[HASH_BYTES_LN];
RtlZeroMemory(hash_bytes, HASH_BYTES_LN);
DPrintW(L"fileCB: %ws\n", file);
hashFileC(file, hash_bytes, (UINT16)ctxt.HashSize, &ctxt);
INT s = hashFileC(file, hash_bytes, (UINT16)ctxt.HashSize, &ctxt);
if ( s != 0 )
return;
lPrintHash(hash_bytes, ctxt.HashSize, file, HASH_TYPE_STR);
}

Expand Down

0 comments on commit 3c3d323

Please sign in to comment.