mirror of
https://github.com/aaru-dps/fstester.git
synced 2025-12-16 19:24:39 +00:00
Add options to write to a log and be quiet.
This commit is contained in:
@@ -37,6 +37,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
#include "attr.h"
|
||||
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
|
||||
extern DWORD oldVersion;
|
||||
|
||||
@@ -59,7 +60,7 @@ void FileAttributes(const char* path)
|
||||
|
||||
if(!lpRootPathName)
|
||||
{
|
||||
printf("Could not allocate memory.\n");
|
||||
log_write("Could not allocate memory.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -73,7 +74,7 @@ void FileAttributes(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu changing to specified path.\n", error);
|
||||
log_write("Error %lu changing to specified path.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -82,7 +83,7 @@ void FileAttributes(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu creating working directory.\n", error);
|
||||
log_write("Error %lu creating working directory.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -91,11 +92,11 @@ void FileAttributes(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu changing to working directory.\n", error);
|
||||
log_write("Error %lu changing to working directory.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Creating attributes files.\n");
|
||||
log_write("Creating attributes files.\n");
|
||||
|
||||
for(i = 0; i < KNOWN_WIN32_ATTRS; i++)
|
||||
{
|
||||
@@ -119,12 +120,12 @@ void FileAttributes(const char* path)
|
||||
if(!ret) cRc = GetLastError();
|
||||
}
|
||||
|
||||
printf("\t%s: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
win32_attrs[i].description,
|
||||
win32_attrs[i].filename,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
log_write("\t%s: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
win32_attrs[i].description,
|
||||
win32_attrs[i].filename,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
}
|
||||
|
||||
if(WinGetVersionExA)
|
||||
@@ -135,7 +136,7 @@ void FileAttributes(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu querying Windows version.\n", error);
|
||||
log_write("Error %lu querying Windows version.\n", error);
|
||||
free(lpRootPathName);
|
||||
return;
|
||||
}
|
||||
@@ -164,7 +165,7 @@ void FileAttributes(const char* path)
|
||||
ret = CloseHandle(h);
|
||||
if(!ret) cRc = GetLastError();
|
||||
}
|
||||
printf("\tFile is compressed: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", "COMPRESS", rc, wRc, cRc);
|
||||
log_write("\tFile is compressed: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", "COMPRESS", rc, wRc, cRc);
|
||||
}
|
||||
|
||||
advapi32 = LoadLibraryA("ADVAPI32.DLL");
|
||||
@@ -205,14 +206,14 @@ void FileAttributes(const char* path)
|
||||
ret = SetFileAttributesA(encrypted_win32_attrs[i].filename, encrypted_win32_attrs[i].attr);
|
||||
if(!ret) aRc = GetLastError();
|
||||
}
|
||||
printf("\t%s: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu, aRc = %lu, eRc = %lu\n",
|
||||
encrypted_win32_attrs[i].description,
|
||||
encrypted_win32_attrs[i].filename,
|
||||
rc,
|
||||
wRc,
|
||||
cRc,
|
||||
aRc,
|
||||
eRc);
|
||||
log_write("\t%s: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu, aRc = %lu, eRc = %lu\n",
|
||||
encrypted_win32_attrs[i].description,
|
||||
encrypted_win32_attrs[i].filename,
|
||||
rc,
|
||||
wRc,
|
||||
cRc,
|
||||
aRc,
|
||||
eRc);
|
||||
}
|
||||
|
||||
FreeLibrary(advapi32);
|
||||
|
||||
@@ -38,6 +38,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
|
||||
#include "win32.h"
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
|
||||
void DeleteFiles(const char* path)
|
||||
{
|
||||
@@ -53,7 +54,7 @@ void DeleteFiles(const char* path)
|
||||
|
||||
if(!lpRootPathName)
|
||||
{
|
||||
printf("Could not allocate memory.\n");
|
||||
log_write("Could not allocate memory.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -67,7 +68,7 @@ void DeleteFiles(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu changing to specified path.\n", error);
|
||||
log_write("Error %lu changing to specified path.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -76,7 +77,7 @@ void DeleteFiles(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu creating working directory.\n", error);
|
||||
log_write("Error %lu creating working directory.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -85,11 +86,11 @@ void DeleteFiles(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu changing to working directory.\n", error);
|
||||
log_write("Error %lu changing to working directory.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Creating and deleting files.\n");
|
||||
log_write("Creating and deleting files.\n");
|
||||
|
||||
for(pos = 0; pos < 64; pos++)
|
||||
{
|
||||
|
||||
@@ -34,6 +34,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
|
||||
#include "win32.h"
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
|
||||
void DirectoryDepth(const char* path)
|
||||
{
|
||||
@@ -48,7 +49,7 @@ void DirectoryDepth(const char* path)
|
||||
|
||||
if(!lpRootPathName)
|
||||
{
|
||||
printf("Could not allocate memory.\n");
|
||||
log_write("Could not allocate memory.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -62,7 +63,7 @@ void DirectoryDepth(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu changing to specified path.\n", error);
|
||||
log_write("Error %lu changing to specified path.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -71,7 +72,7 @@ void DirectoryDepth(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu creating working directory.\n", error);
|
||||
log_write("Error %lu creating working directory.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -80,11 +81,11 @@ void DirectoryDepth(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu changing to working directory.\n", error);
|
||||
log_write("Error %lu changing to working directory.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Creating deepest directory tree.\n");
|
||||
log_write("Creating deepest directory tree.\n");
|
||||
|
||||
while(ret)
|
||||
{
|
||||
@@ -97,5 +98,5 @@ void DirectoryDepth(const char* path)
|
||||
pos++;
|
||||
}
|
||||
|
||||
printf("\tCreated %ld levels of directory hierarchy\n", pos);
|
||||
log_write("\tCreated %ld levels of directory hierarchy\n", pos);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
#include "win32.h"
|
||||
#include "../include/consts.h"
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
|
||||
void Filenames(const char* path)
|
||||
{
|
||||
@@ -52,7 +53,7 @@ void Filenames(const char* path)
|
||||
|
||||
if(!lpRootPathName)
|
||||
{
|
||||
printf("Could not allocate memory.\n");
|
||||
log_write("Could not allocate memory.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -66,7 +67,7 @@ void Filenames(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu changing to specified path.\n", error);
|
||||
log_write("Error %lu changing to specified path.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -75,7 +76,7 @@ void Filenames(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu creating working directory.\n", error);
|
||||
log_write("Error %lu creating working directory.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -84,11 +85,11 @@ void Filenames(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu changing to working directory.\n", error);
|
||||
log_write("Error %lu changing to working directory.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Creating files with different filenames.\n");
|
||||
log_write("Creating files with different filenames.\n");
|
||||
|
||||
for(pos = 0; filenames[pos]; pos++)
|
||||
{
|
||||
@@ -110,6 +111,6 @@ void Filenames(const char* path)
|
||||
if(!ret) cRc = GetLastError();
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", filenames[pos], rc, wRc, cRc);
|
||||
log_write("\tFile name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", filenames[pos], rc, wRc, cRc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
|
||||
#include "win32.h"
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
|
||||
void MillionFiles(const char* path)
|
||||
{
|
||||
@@ -49,7 +50,7 @@ void MillionFiles(const char* path)
|
||||
|
||||
if(!lpRootPathName)
|
||||
{
|
||||
printf("Could not allocate memory.\n");
|
||||
log_write("Could not allocate memory.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -63,7 +64,7 @@ void MillionFiles(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu changing to specified path.\n", error);
|
||||
log_write("Error %lu changing to specified path.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -72,7 +73,7 @@ void MillionFiles(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu creating working directory.\n", error);
|
||||
log_write("Error %lu creating working directory.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -81,11 +82,11 @@ void MillionFiles(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu changing to working directory.\n", error);
|
||||
log_write("Error %lu changing to working directory.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Creating lots of files.\n");
|
||||
log_write("Creating lots of files.\n");
|
||||
|
||||
for(pos = 0; pos < 1000; pos++)
|
||||
{
|
||||
@@ -98,5 +99,5 @@ void MillionFiles(const char* path)
|
||||
CloseHandle(h);
|
||||
}
|
||||
|
||||
printf("\tCreated %lu files\n", pos);
|
||||
log_write("\tCreated %lu files\n", pos);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
#include "win32.h"
|
||||
#include "../include/consts.h"
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
|
||||
void Fragmentation(const char* path, size_t clusterSize)
|
||||
{
|
||||
@@ -57,7 +58,7 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
|
||||
if(!lpRootPathName)
|
||||
{
|
||||
printf("Could not allocate memory.\n");
|
||||
log_write("Could not allocate memory.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -71,7 +72,7 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu changing to specified path.\n", error);
|
||||
log_write("Error %lu changing to specified path.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -80,7 +81,7 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu creating working directory.\n", error);
|
||||
log_write("Error %lu creating working directory.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -89,7 +90,7 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu changing to working directory.\n", error);
|
||||
log_write("Error %lu changing to working directory.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -113,7 +114,12 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", size = "SIZE_T_FORMAT", rc = %lu, wRc = %lu, cRc = %lu\n", "HALFCLST", halfCluster, rc, wRc, cRc);
|
||||
log_write("\tFile name = \"%s\", size = " SIZE_T_FORMAT ", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"HALFCLST",
|
||||
halfCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
|
||||
h = CreateFileA("QUARCLST", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
rc = 0;
|
||||
@@ -135,8 +141,12 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
printf(
|
||||
"\tFile name = \"%s\", size = "SIZE_T_FORMAT", rc = %lu, wRc = %lu, cRc = %lu\n", "QUARCLST", quarterCluster, rc, wRc, cRc);
|
||||
log_write("\tFile name = \"%s\", size = " SIZE_T_FORMAT ", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"QUARCLST",
|
||||
quarterCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
|
||||
h = CreateFileA("TWOCLST", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
rc = 0;
|
||||
@@ -158,7 +168,12 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", size = "SIZE_T_FORMAT", rc = %lu, wRc = %lu, cRc = %lu\n", "TWOCLST", twoCluster, rc, wRc, cRc);
|
||||
log_write("\tFile name = \"%s\", size = " SIZE_T_FORMAT ", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"TWOCLST",
|
||||
twoCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
|
||||
h = CreateFileA("TRQTCLST", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
rc = 0;
|
||||
@@ -180,12 +195,12 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", size = "SIZE_T_FORMAT", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"TRQTCLST",
|
||||
threeQuartersCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
log_write("\tFile name = \"%s\", size = " SIZE_T_FORMAT ", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"TRQTCLST",
|
||||
threeQuartersCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
|
||||
h = CreateFileA("TWTQCLST", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
rc = 0;
|
||||
@@ -207,12 +222,12 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", size = "SIZE_T_FORMAT", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"TWTQCLST",
|
||||
twoAndThreeQuartCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
log_write("\tFile name = \"%s\", size = " SIZE_T_FORMAT ", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"TWTQCLST",
|
||||
twoAndThreeQuartCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
|
||||
h = CreateFileA("TWO1", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
rc = 0;
|
||||
@@ -234,7 +249,12 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", size = "SIZE_T_FORMAT", rc = %lu, wRc = %lu, cRc = %lu\n", "TWO1", twoCluster, rc, wRc, cRc);
|
||||
log_write("\tFile name = \"%s\", size = " SIZE_T_FORMAT ", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"TWO1",
|
||||
twoCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
|
||||
h = CreateFileA("TWO2", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
rc = 0;
|
||||
@@ -256,7 +276,12 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", size = "SIZE_T_FORMAT", rc = %lu, wRc = %lu, cRc = %lu\n", "TWO2", twoCluster, rc, wRc, cRc);
|
||||
log_write("\tFile name = \"%s\", size = " SIZE_T_FORMAT ", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"TWO2",
|
||||
twoCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
|
||||
h = CreateFileA("TWO3", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
rc = 0;
|
||||
@@ -278,11 +303,16 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
printf("\tDeleting \"TWO2\".\n");
|
||||
log_write("\tDeleting \"TWO2\".\n");
|
||||
ret = DeleteFileA("TWO2");
|
||||
if(!ret) { rc = GetLastError(); }
|
||||
|
||||
printf("\tFile name = \"%s\", size = "SIZE_T_FORMAT", rc = %lu, wRc = %lu, cRc = %lu\n", "TWO3", twoCluster, rc, wRc, cRc);
|
||||
log_write("\tFile name = \"%s\", size = " SIZE_T_FORMAT ", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"TWO3",
|
||||
twoCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
|
||||
h = CreateFileA("FRAGTHRQ", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
rc = 0;
|
||||
@@ -304,19 +334,19 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
printf("\tDeleting \"TWO1\".\n");
|
||||
log_write("\tDeleting \"TWO1\".\n");
|
||||
ret = DeleteFileA("TWO1");
|
||||
if(!ret) { rc = GetLastError(); }
|
||||
printf("\tDeleting \"TWO3\".\n");
|
||||
log_write("\tDeleting \"TWO3\".\n");
|
||||
ret = DeleteFileA("TWO3");
|
||||
if(!ret) { rc = GetLastError(); }
|
||||
|
||||
printf("\tFile name = \"%s\", size = "SIZE_T_FORMAT", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"FRAGTHRQ",
|
||||
threeQuartersCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
log_write("\tFile name = \"%s\", size = " SIZE_T_FORMAT ", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"FRAGTHRQ",
|
||||
threeQuartersCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
|
||||
h = CreateFileA("FRAGSIXQ", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
rc = 0;
|
||||
@@ -338,10 +368,10 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", size = "SIZE_T_FORMAT", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"FRAGSIXQ",
|
||||
twoAndThreeQuartCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
log_write("\tFile name = \"%s\", size = " SIZE_T_FORMAT ", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"FRAGSIXQ",
|
||||
twoAndThreeQuartCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
#include "links.h"
|
||||
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
|
||||
extern DWORD oldVersion;
|
||||
|
||||
@@ -62,7 +63,7 @@ void Links(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu querying Windows version.\n", error);
|
||||
log_write("Error %lu querying Windows version.\n", error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -79,7 +80,7 @@ void Links(const char* path)
|
||||
|
||||
if(!lpRootPathName)
|
||||
{
|
||||
printf("Could not allocate memory.\n");
|
||||
log_write("Could not allocate memory.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -93,7 +94,7 @@ void Links(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu changing to specified path.\n", error);
|
||||
log_write("Error %lu changing to specified path.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -102,7 +103,7 @@ void Links(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu creating working directory.\n", error);
|
||||
log_write("Error %lu creating working directory.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -111,7 +112,7 @@ void Links(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu changing to working directory.\n", error);
|
||||
log_write("Error %lu changing to working directory.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -120,7 +121,7 @@ void Links(const char* path)
|
||||
if(!kernel32)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu loading KERNEL32.DLL.\n", error);
|
||||
log_write("Error %lu loading KERNEL32.DLL.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -129,12 +130,12 @@ void Links(const char* path)
|
||||
if(!func)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu finding CreateSymbolicLinkA.\n", error);
|
||||
log_write("Error %lu finding CreateSymbolicLinkA.\n", error);
|
||||
}
|
||||
else
|
||||
{
|
||||
WinNtCreateSymbolicLinkA = func;
|
||||
printf("Creating symbolic links.\n");
|
||||
log_write("Creating symbolic links.\n");
|
||||
|
||||
h = CreateFileA("TARGET",
|
||||
dwFilePermissions,
|
||||
@@ -162,7 +163,7 @@ void Links(const char* path)
|
||||
if(!ret) lRc = GetLastError();
|
||||
}
|
||||
|
||||
printf("\tSymbolic link, rc = 0x%08lx, wRc = %lu, cRc = %lu, lRc = %lu\n", rc, wRc, cRc, lRc);
|
||||
log_write("\tSymbolic link, rc = 0x%08lx, wRc = %lu, cRc = %lu, lRc = %lu\n", rc, wRc, cRc, lRc);
|
||||
}
|
||||
|
||||
func = GetProcAddress(kernel32, "CreateHardLinkA");
|
||||
@@ -170,12 +171,12 @@ void Links(const char* path)
|
||||
if(!func)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu finding CreateHardLinkA.\n", error);
|
||||
log_write("Error %lu finding CreateHardLinkA.\n", error);
|
||||
}
|
||||
else
|
||||
{
|
||||
WinNtCreateHardLinkA = func;
|
||||
printf("Creating hard links.\n");
|
||||
log_write("Creating hard links.\n");
|
||||
|
||||
h = CreateFileA("HARDTRGT",
|
||||
dwFilePermissions,
|
||||
@@ -203,7 +204,7 @@ void Links(const char* path)
|
||||
if(!ret) lRc = GetLastError();
|
||||
}
|
||||
|
||||
printf("\tHard link, rc = 0x%08lx, wRc = %lu, cRc = %lu, lRc = %lu\n", rc, wRc, cRc, lRc);
|
||||
log_write("\tHard link, rc = 0x%08lx, wRc = %lu, cRc = %lu, lRc = %lu\n", rc, wRc, cRc, lRc);
|
||||
}
|
||||
|
||||
FreeLibrary(kernel32);
|
||||
|
||||
@@ -36,6 +36,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
#include "os.h"
|
||||
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
|
||||
DWORD oldVersion;
|
||||
|
||||
@@ -59,9 +60,10 @@ void GetOsInfo()
|
||||
oldVersion &= 0x80000000;
|
||||
|
||||
if(oldVersion == 0)
|
||||
printf("\tRunning under Windows %lu.%lu using Win32s.\n", verInfo.dwMajorVersion, verInfo.dwMinorVersion);
|
||||
log_write(
|
||||
"\tRunning under Windows %lu.%lu using Win32s.\n", verInfo.dwMajorVersion, verInfo.dwMinorVersion);
|
||||
else
|
||||
printf("\tRunning under Windows NT %lu.%lu.\n", verInfo.dwMajorVersion, verInfo.dwMinorVersion);
|
||||
log_write("\tRunning under Windows NT %lu.%lu.\n", verInfo.dwMajorVersion, verInfo.dwMinorVersion);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -77,9 +79,10 @@ void GetOsInfo()
|
||||
oldVersion &= 0x80000000;
|
||||
|
||||
if(oldVersion == 0)
|
||||
printf("\tRunning under Windows %lu.%lu using Win32s.\n", verInfo.dwMajorVersion, verInfo.dwMinorVersion);
|
||||
log_write(
|
||||
"\tRunning under Windows %lu.%lu using Win32s.\n", verInfo.dwMajorVersion, verInfo.dwMinorVersion);
|
||||
else
|
||||
printf("\tRunning under Windows NT %lu.%lu.\n", verInfo.dwMajorVersion, verInfo.dwMinorVersion);
|
||||
log_write("\tRunning under Windows NT %lu.%lu.\n", verInfo.dwMajorVersion, verInfo.dwMinorVersion);
|
||||
|
||||
FreeLibrary(kernel32);
|
||||
|
||||
@@ -94,49 +97,49 @@ void GetOsInfo()
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu querying Windows version.\n", error);
|
||||
log_write("Error %lu querying Windows version.\n", error);
|
||||
FreeLibrary(kernel32);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("OS information:\n");
|
||||
log_write("OS information:\n");
|
||||
|
||||
if(verInfo.dwPlatformId == VER_PLATFORM_WIN32s)
|
||||
printf("\tRunning under Windows %lu.%lu using Win32s.\n", verInfo.dwMajorVersion, verInfo.dwMinorVersion);
|
||||
log_write("\tRunning under Windows %lu.%lu using Win32s.\n", verInfo.dwMajorVersion, verInfo.dwMinorVersion);
|
||||
else if(verInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
|
||||
{
|
||||
if(verInfo.dwMinorVersion == 10)
|
||||
{
|
||||
if(verInfo.dwBuildNumber == 2222) printf("\tRunning under Windows 98 SE");
|
||||
if(verInfo.dwBuildNumber == 2222) log_write("\tRunning under Windows 98 SE");
|
||||
else
|
||||
printf("\tRunning under Windows 98");
|
||||
log_write("\tRunning under Windows 98");
|
||||
}
|
||||
else if(verInfo.dwMinorVersion == 90)
|
||||
printf("\tRunning under Windows Me");
|
||||
log_write("\tRunning under Windows Me");
|
||||
else if(verInfo.dwMinorVersion < 10)
|
||||
printf("\tRunning under Windows 95");
|
||||
log_write("\tRunning under Windows 95");
|
||||
else
|
||||
printf("\tRunning under Windows");
|
||||
log_write("\tRunning under Windows");
|
||||
|
||||
if(verInfo.dwBuildNumber > 0)
|
||||
{
|
||||
if(strlen(verInfo.szCSDVersion) > 0)
|
||||
printf(" version %lu.%02lu.%lu%ss.\n",
|
||||
verInfo.dwMajorVersion,
|
||||
verInfo.dwMinorVersion,
|
||||
verInfo.dwBuildNumber,
|
||||
verInfo.szCSDVersion);
|
||||
log_write(" version %lu.%02lu.%lu%ss.\n",
|
||||
verInfo.dwMajorVersion,
|
||||
verInfo.dwMinorVersion,
|
||||
verInfo.dwBuildNumber,
|
||||
verInfo.szCSDVersion);
|
||||
else
|
||||
printf(
|
||||
log_write(
|
||||
" version %lu.%02lu%lud.\n", verInfo.dwMajorVersion, verInfo.dwMinorVersion, verInfo.dwBuildNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(strlen(verInfo.szCSDVersion) > 0)
|
||||
printf(
|
||||
log_write(
|
||||
" version %lu.%02lu %s.\n", verInfo.dwMajorVersion, verInfo.dwMinorVersion, verInfo.szCSDVersion);
|
||||
else
|
||||
printf(" version %lu.%02lu.\n", verInfo.dwMajorVersion, verInfo.dwMinorVersion);
|
||||
log_write(" version %lu.%02lu.\n", verInfo.dwMajorVersion, verInfo.dwMinorVersion);
|
||||
}
|
||||
}
|
||||
else if(verInfo.dwPlatformId == VER_PLATFORM_WIN32_NT)
|
||||
@@ -146,24 +149,24 @@ void GetOsInfo()
|
||||
case 5:
|
||||
switch(verInfo.dwMinorVersion)
|
||||
{
|
||||
case 0: printf("\tRunning under Windows 2000"); break;
|
||||
case 1: printf("\tRunning under Windows XP"); break;
|
||||
case 2: printf("\tRunning under Windows Server 2003"); break;
|
||||
default: printf("\tRunning under Windows NT");
|
||||
case 0: log_write("\tRunning under Windows 2000"); break;
|
||||
case 1: log_write("\tRunning under Windows XP"); break;
|
||||
case 2: log_write("\tRunning under Windows Server 2003"); break;
|
||||
default: log_write("\tRunning under Windows NT");
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
switch(verInfo.dwMinorVersion)
|
||||
{
|
||||
case 0: printf("\tRunning under Windows Vista"); break;
|
||||
case 1: printf("\tRunning under Windows 7"); break;
|
||||
case 2: printf("\tRunning under Windows 8"); break;
|
||||
case 3: printf("\tRunning under Windows 8.1"); break;
|
||||
default: printf("\tRunning under Windows NT"); break;
|
||||
case 0: log_write("\tRunning under Windows Vista"); break;
|
||||
case 1: log_write("\tRunning under Windows 7"); break;
|
||||
case 2: log_write("\tRunning under Windows 8"); break;
|
||||
case 3: log_write("\tRunning under Windows 8.1"); break;
|
||||
default: log_write("\tRunning under Windows NT"); break;
|
||||
}
|
||||
break;
|
||||
case 10: printf("\tRunning under Windows 10"); break;
|
||||
default: printf("\tRunning under Windows NT"); break;
|
||||
case 10: log_write("\tRunning under Windows 10"); break;
|
||||
default: log_write("\tRunning under Windows NT"); break;
|
||||
}
|
||||
|
||||
if(verInfo.dwMinorVersion < 10) verInfo.dwMinorVersion = verInfo.dwMinorVersion * 10;
|
||||
@@ -171,22 +174,22 @@ void GetOsInfo()
|
||||
if(verInfo.dwBuildNumber > 0)
|
||||
{
|
||||
if(strlen(verInfo.szCSDVersion) > 0)
|
||||
printf(" version %lu.%02lu.%lu %s.\n",
|
||||
verInfo.dwMajorVersion,
|
||||
verInfo.dwMinorVersion,
|
||||
verInfo.dwBuildNumber,
|
||||
verInfo.szCSDVersion);
|
||||
log_write(" version %lu.%02lu.%lu %s.\n",
|
||||
verInfo.dwMajorVersion,
|
||||
verInfo.dwMinorVersion,
|
||||
verInfo.dwBuildNumber,
|
||||
verInfo.szCSDVersion);
|
||||
else
|
||||
printf(
|
||||
log_write(
|
||||
" version %lu.%02lu.%lu.\n", verInfo.dwMajorVersion, verInfo.dwMinorVersion, verInfo.dwBuildNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(strlen(verInfo.szCSDVersion) > 0)
|
||||
printf(
|
||||
log_write(
|
||||
" version %lu.%02lu %s.\n", verInfo.dwMajorVersion, verInfo.dwMinorVersion, verInfo.szCSDVersion);
|
||||
else
|
||||
printf(" version %lu%02lud.\n", verInfo.dwMajorVersion, verInfo.dwMinorVersion);
|
||||
log_write(" version %lu%02lud.\n", verInfo.dwMajorVersion, verInfo.dwMinorVersion);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
#include "rsrcfork.h"
|
||||
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
|
||||
extern DWORD oldVersion;
|
||||
|
||||
@@ -60,7 +61,7 @@ void ResourceFork(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu querying Windows version.\n", error);
|
||||
log_write("Error %lu querying Windows version.\n", error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -77,7 +78,7 @@ void ResourceFork(const char* path)
|
||||
|
||||
if(!lpRootPathName)
|
||||
{
|
||||
printf("Could not allocate memory.\n");
|
||||
log_write("Could not allocate memory.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -91,7 +92,7 @@ void ResourceFork(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu changing to specified path.\n", error);
|
||||
log_write("Error %lu changing to specified path.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -100,7 +101,7 @@ void ResourceFork(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu creating working directory.\n", error);
|
||||
log_write("Error %lu creating working directory.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -109,11 +110,11 @@ void ResourceFork(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu changing to working directory.\n", error);
|
||||
log_write("Error %lu changing to working directory.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Creating alternate data streams.\n");
|
||||
log_write("Creating alternate data streams.\n");
|
||||
|
||||
h = CreateFileA("TINY:ADS", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
rc = 0;
|
||||
@@ -128,11 +129,11 @@ void ResourceFork(const char* path)
|
||||
ret = CloseHandle(h);
|
||||
if(!ret) cRc = GetLastError();
|
||||
}
|
||||
printf("\tFile with tiny alternate data stream: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"TINY:ADS",
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
log_write("\tFile with tiny alternate data stream: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"TINY:ADS",
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
|
||||
maxLoop = (4095 - strlen(smallAdsText)) / strlen(smallAdsRepeatText);
|
||||
h = CreateFileA("SMALL:ADS", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
@@ -158,11 +159,11 @@ void ResourceFork(const char* path)
|
||||
ret = CloseHandle(h);
|
||||
if(!ret) cRc = GetLastError();
|
||||
}
|
||||
printf("\tFile with small alternate data stream: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"SMALL:ADS",
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
log_write("\tFile with small alternate data stream: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"SMALL:ADS",
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
|
||||
maxLoop = (65535 - strlen(mediumAdsText)) / strlen(mediumAdsRepeatText);
|
||||
h = CreateFileA("MEDIUM:ADS", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
@@ -189,11 +190,11 @@ void ResourceFork(const char* path)
|
||||
ret = CloseHandle(h);
|
||||
if(!ret) cRc = GetLastError();
|
||||
}
|
||||
printf("\tFile with medium alternate data stream: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"MEDIUM:ADS",
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
log_write("\tFile with medium alternate data stream: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"MEDIUM:ADS",
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
|
||||
maxLoop = (67584 - strlen(bigAdsText)) / strlen(bigAdsRepeatText);
|
||||
h = CreateFileA("BIG:ADS", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
@@ -219,11 +220,11 @@ void ResourceFork(const char* path)
|
||||
ret = CloseHandle(h);
|
||||
if(!ret) cRc = GetLastError();
|
||||
}
|
||||
printf("\tFile with big alternate data stream: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"BIG:ADS",
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
log_write("\tFile with big alternate data stream: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"BIG:ADS",
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
|
||||
h = CreateFileA("MULTIPLE:ADS", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
rc = 0;
|
||||
@@ -238,11 +239,11 @@ void ResourceFork(const char* path)
|
||||
ret = CloseHandle(h);
|
||||
if(!ret) cRc = GetLastError();
|
||||
}
|
||||
printf("\tFile with tiny alternate data stream: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"MULTIPLE:ADS",
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
log_write("\tFile with tiny alternate data stream: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"MULTIPLE:ADS",
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
|
||||
maxLoop = (4095 - strlen(smallAdsText)) / strlen(smallAdsRepeatText);
|
||||
h = CreateFileA("MULTIPLE:ADS", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
@@ -269,11 +270,11 @@ void ResourceFork(const char* path)
|
||||
ret = CloseHandle(h);
|
||||
if(!ret) cRc = GetLastError();
|
||||
}
|
||||
printf("\tFile with small alternate data stream: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"MULTIPLE:ADS",
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
log_write("\tFile with small alternate data stream: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"MULTIPLE:ADS",
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
|
||||
maxLoop = (65535 - strlen(mediumAdsText)) / strlen(mediumAdsRepeatText);
|
||||
h = CreateFileA("MULTIPLE:ADS", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
@@ -301,11 +302,11 @@ void ResourceFork(const char* path)
|
||||
ret = CloseHandle(h);
|
||||
if(!ret) cRc = GetLastError();
|
||||
}
|
||||
printf("\tFile with medium alternate data stream: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"MULTIPLE:ADS",
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
log_write("\tFile with medium alternate data stream: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"MULTIPLE:ADS",
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
|
||||
maxLoop = (67584 - strlen(bigAdsText)) / strlen(bigAdsRepeatText);
|
||||
h = CreateFileA("MULTIPLE:ADS", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
@@ -332,9 +333,9 @@ void ResourceFork(const char* path)
|
||||
ret = CloseHandle(h);
|
||||
if(!ret) cRc = GetLastError();
|
||||
}
|
||||
printf("\tFile with medium alternate data stream: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"MULTIPLE:ADS",
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
log_write("\tFile with medium alternate data stream: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n",
|
||||
"MULTIPLE:ADS",
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
|
||||
#include "../include/consts.h"
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
|
||||
void Sparse(const char* path)
|
||||
{
|
||||
@@ -60,7 +61,7 @@ void Sparse(const char* path)
|
||||
|
||||
if(lpVolumeNameBuffer == NULL)
|
||||
{
|
||||
printf("Could not allocate memory.\n");
|
||||
log_write("Could not allocate memory.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -68,7 +69,7 @@ void Sparse(const char* path)
|
||||
|
||||
if(lpFileSystemNameBuffer == NULL)
|
||||
{
|
||||
printf("Could not allocate memory.\n");
|
||||
log_write("Could not allocate memory.\n");
|
||||
free(lpVolumeNameBuffer);
|
||||
return;
|
||||
}
|
||||
@@ -77,7 +78,7 @@ void Sparse(const char* path)
|
||||
|
||||
if(!lpRootPathName)
|
||||
{
|
||||
printf("Could not allocate memory.\n");
|
||||
log_write("Could not allocate memory.\n");
|
||||
free(lpVolumeNameBuffer);
|
||||
free(lpFileSystemNameBuffer);
|
||||
return;
|
||||
@@ -100,7 +101,7 @@ void Sparse(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu querying volume information.\n", error);
|
||||
log_write("Error %lu querying volume information.\n", error);
|
||||
free(lpVolumeNameBuffer);
|
||||
free(lpFileSystemNameBuffer);
|
||||
free(lpRootPathName);
|
||||
@@ -121,7 +122,7 @@ void Sparse(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu changing to specified path.\n", error);
|
||||
log_write("Error %lu changing to specified path.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -130,7 +131,7 @@ void Sparse(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu creating working directory.\n", error);
|
||||
log_write("Error %lu creating working directory.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -139,13 +140,13 @@ void Sparse(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu changing to working directory.\n", error);
|
||||
log_write("Error %lu changing to working directory.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
free(lpRootPathName);
|
||||
|
||||
printf("Creating sparse files.\n");
|
||||
log_write("Creating sparse files.\n");
|
||||
|
||||
h = CreateFileA("SMALL", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
rc = 0;
|
||||
@@ -213,14 +214,14 @@ void Sparse(const char* path)
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", size = %d, rc = %lu, wRc = %lu, cRc = %lu, sRc = %lu, zRc = %lu\n",
|
||||
"SMALL",
|
||||
4096 * 3,
|
||||
rc,
|
||||
wRc,
|
||||
cRc,
|
||||
sRc,
|
||||
zRc);
|
||||
log_write("\tFile name = \"%s\", size = %d, rc = %lu, wRc = %lu, cRc = %lu, sRc = %lu, zRc = %lu\n",
|
||||
"SMALL",
|
||||
4096 * 3,
|
||||
rc,
|
||||
wRc,
|
||||
cRc,
|
||||
sRc,
|
||||
zRc);
|
||||
|
||||
h = CreateFileA("BIG", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
rc = 0;
|
||||
@@ -288,12 +289,12 @@ void Sparse(const char* path)
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", size = %d, rc = %lu, wRc = %lu, cRc = %lu, sRc = %lu, zRc = %lu\n",
|
||||
"BIG",
|
||||
4096 * 30,
|
||||
rc,
|
||||
wRc,
|
||||
cRc,
|
||||
sRc,
|
||||
zRc);
|
||||
log_write("\tFile name = \"%s\", size = %d, rc = %lu, wRc = %lu, cRc = %lu, sRc = %lu, zRc = %lu\n",
|
||||
"BIG",
|
||||
4096 * 30,
|
||||
rc,
|
||||
wRc,
|
||||
cRc,
|
||||
sRc,
|
||||
zRc);
|
||||
}
|
||||
|
||||
@@ -37,24 +37,25 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
#include "time.h"
|
||||
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
|
||||
void Timestamps(const char* path)
|
||||
{
|
||||
char message[300];
|
||||
BOOL ret;
|
||||
DWORD error;
|
||||
LPSTR lpRootPathName;
|
||||
size_t pathSize = strlen(path);
|
||||
HANDLE h;
|
||||
DWORD rc, wRc, cRc, tRc;
|
||||
DWORD dwNumberOfBytesWritten;
|
||||
int i;
|
||||
char message[300];
|
||||
BOOL ret;
|
||||
DWORD error;
|
||||
LPSTR lpRootPathName;
|
||||
size_t pathSize = strlen(path);
|
||||
HANDLE h;
|
||||
DWORD rc, wRc, cRc, tRc;
|
||||
DWORD dwNumberOfBytesWritten;
|
||||
int i;
|
||||
|
||||
lpRootPathName = malloc(dwMaxNameSize);
|
||||
|
||||
if(!lpRootPathName)
|
||||
{
|
||||
printf("Could not allocate memory.\n");
|
||||
log_write("Could not allocate memory.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -68,7 +69,7 @@ void Timestamps(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu changing to specified path.\n", error);
|
||||
log_write("Error %lu changing to specified path.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -77,7 +78,7 @@ void Timestamps(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu creating working directory.\n", error);
|
||||
log_write("Error %lu creating working directory.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -86,11 +87,11 @@ void Timestamps(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu changing to working directory.\n", error);
|
||||
log_write("Error %lu changing to working directory.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Creating timestamped files.\n");
|
||||
log_write("Creating timestamped files.\n");
|
||||
|
||||
for(i = 0; i < KNOWN_WIN32_TIMESTAMPS; i++)
|
||||
{
|
||||
@@ -125,11 +126,11 @@ void Timestamps(const char* path)
|
||||
if(!ret) cRc = GetLastError();
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu, tRc = %lu\n",
|
||||
win32_timestamps[i].filename,
|
||||
rc,
|
||||
wRc,
|
||||
cRc,
|
||||
tRc);
|
||||
log_write("\tFile name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu, tRc = %lu\n",
|
||||
win32_timestamps[i].filename,
|
||||
rc,
|
||||
wRc,
|
||||
cRc,
|
||||
tRc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
#include "volume.h"
|
||||
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
|
||||
extern DWORD oldVersion;
|
||||
|
||||
@@ -63,14 +64,14 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
|
||||
|
||||
*clusterSize = 0;
|
||||
|
||||
printf("Volume information:\n");
|
||||
printf("\tPath: %s\n", path);
|
||||
log_write("Volume information:\n");
|
||||
log_write("\tPath: %s\n", path);
|
||||
|
||||
lpVolumeNameBuffer = malloc(dwMaxNameSize);
|
||||
|
||||
if(lpVolumeNameBuffer == NULL)
|
||||
{
|
||||
printf("Could not allocate memory.\n");
|
||||
log_write("Could not allocate memory.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -78,7 +79,7 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
|
||||
|
||||
if(lpFileSystemNameBuffer == NULL)
|
||||
{
|
||||
printf("Could not allocate memory.\n");
|
||||
log_write("Could not allocate memory.\n");
|
||||
free(lpVolumeNameBuffer);
|
||||
return;
|
||||
}
|
||||
@@ -87,7 +88,7 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
|
||||
|
||||
if(!lpRootPathName)
|
||||
{
|
||||
printf("Could not allocate memory.\n");
|
||||
log_write("Could not allocate memory.\n");
|
||||
free(lpVolumeNameBuffer);
|
||||
free(lpFileSystemNameBuffer);
|
||||
return;
|
||||
@@ -110,160 +111,160 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu querying volume information.\n", error);
|
||||
log_write("Error %lu querying volume information.\n", error);
|
||||
free(lpVolumeNameBuffer);
|
||||
free(lpFileSystemNameBuffer);
|
||||
free(lpRootPathName);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("\tFilesystem: %s\n", lpFileSystemNameBuffer);
|
||||
printf("\tVolume name: %s\n", lpVolumeNameBuffer);
|
||||
printf("\tMaximum component size: %lu\n", dwMaximumComponentLength);
|
||||
log_write("\tFilesystem: %s\n", lpFileSystemNameBuffer);
|
||||
log_write("\tVolume name: %s\n", lpVolumeNameBuffer);
|
||||
log_write("\tMaximum component size: %lu\n", dwMaximumComponentLength);
|
||||
|
||||
if(dwFileSystemFlags > 0)
|
||||
{
|
||||
printf("\tFlags:\n");
|
||||
log_write("\tFlags:\n");
|
||||
|
||||
if(dwFileSystemFlags & (DWORD)FILE_CASE_PRESERVED_NAMES)
|
||||
{
|
||||
printf("\t\tVolume preserves file name case.\n");
|
||||
log_write("\t\tVolume preserves file name case.\n");
|
||||
dwFileSystemFlags -= FILE_CASE_PRESERVED_NAMES;
|
||||
}
|
||||
|
||||
if(dwFileSystemFlags & (DWORD)FILE_CASE_SENSITIVE_SEARCH)
|
||||
{
|
||||
printf("\t\tVolume supports case sensitiveness.\n");
|
||||
log_write("\t\tVolume supports case sensitiveness.\n");
|
||||
dwFileSystemFlags -= FILE_CASE_SENSITIVE_SEARCH;
|
||||
}
|
||||
|
||||
if(dwFileSystemFlags & (DWORD)FILE_DAX_VOLUME)
|
||||
{
|
||||
printf("\t\tDirect access volume.\n");
|
||||
log_write("\t\tDirect access volume.\n");
|
||||
dwFileSystemFlags -= FILE_DAX_VOLUME;
|
||||
}
|
||||
|
||||
if(dwFileSystemFlags & (DWORD)FILE_FILE_COMPRESSION)
|
||||
{
|
||||
printf("\t\tVolume supports per-file compression.\n");
|
||||
log_write("\t\tVolume supports per-file compression.\n");
|
||||
dwFileSystemFlags -= FILE_FILE_COMPRESSION;
|
||||
}
|
||||
|
||||
if(dwFileSystemFlags & (DWORD)FILE_NAMED_STREAMS)
|
||||
{
|
||||
printf("\t\tVolume supports Alternate Data Streams.\n");
|
||||
log_write("\t\tVolume supports Alternate Data Streams.\n");
|
||||
dwFileSystemFlags -= FILE_NAMED_STREAMS;
|
||||
}
|
||||
|
||||
if(dwFileSystemFlags & (DWORD)FILE_PERSISTENT_ACLS)
|
||||
{
|
||||
printf("\t\tVolume supports persistent Access Control Lists.\n");
|
||||
log_write("\t\tVolume supports persistent Access Control Lists.\n");
|
||||
dwFileSystemFlags -= FILE_PERSISTENT_ACLS;
|
||||
}
|
||||
|
||||
if(dwFileSystemFlags & (DWORD)FILE_READ_ONLY_VOLUME)
|
||||
{
|
||||
printf("\t\tVolume is read-only.\n");
|
||||
log_write("\t\tVolume is read-only.\n");
|
||||
dwFileSystemFlags -= FILE_READ_ONLY_VOLUME;
|
||||
}
|
||||
|
||||
if(dwFileSystemFlags & (DWORD)FILE_SEQUENTIAL_WRITE_ONCE)
|
||||
{
|
||||
printf("\t\tVolume supports a single sequential write.\n");
|
||||
log_write("\t\tVolume supports a single sequential write.\n");
|
||||
dwFileSystemFlags -= FILE_SEQUENTIAL_WRITE_ONCE;
|
||||
}
|
||||
|
||||
if(dwFileSystemFlags & (DWORD)FILE_SUPPORTS_ENCRYPTION)
|
||||
{
|
||||
printf("\t\tVolume supports per-file encryption.\n");
|
||||
log_write("\t\tVolume supports per-file encryption.\n");
|
||||
dwFileSystemFlags -= FILE_SUPPORTS_ENCRYPTION;
|
||||
}
|
||||
|
||||
if(dwFileSystemFlags & (DWORD)FILE_SUPPORTS_EXTENDED_ATTRIBUTES)
|
||||
{
|
||||
printf("\t\tVolume supports extended attributes.\n");
|
||||
log_write("\t\tVolume supports extended attributes.\n");
|
||||
dwFileSystemFlags -= FILE_SUPPORTS_EXTENDED_ATTRIBUTES;
|
||||
}
|
||||
|
||||
if(dwFileSystemFlags & (DWORD)FILE_SUPPORTS_HARD_LINKS)
|
||||
{
|
||||
printf("\t\tVolume supports hard links.\n");
|
||||
log_write("\t\tVolume supports hard links.\n");
|
||||
dwFileSystemFlags -= FILE_SUPPORTS_HARD_LINKS;
|
||||
}
|
||||
|
||||
if(dwFileSystemFlags & (DWORD)FILE_SUPPORTS_OBJECT_IDS)
|
||||
{
|
||||
printf("\t\tVolume supports object IDs.\n");
|
||||
log_write("\t\tVolume supports object IDs.\n");
|
||||
dwFileSystemFlags -= FILE_SUPPORTS_OBJECT_IDS;
|
||||
}
|
||||
|
||||
if(dwFileSystemFlags & (DWORD)FILE_SUPPORTS_OPEN_BY_FILE_ID)
|
||||
{
|
||||
printf("\t\tVolume can open files by ID.\n");
|
||||
log_write("\t\tVolume can open files by ID.\n");
|
||||
dwFileSystemFlags -= FILE_SUPPORTS_OPEN_BY_FILE_ID;
|
||||
}
|
||||
|
||||
if(dwFileSystemFlags & (DWORD)FILE_SUPPORTS_REPARSE_POINTS)
|
||||
{
|
||||
printf("\t\tVolume supports reparse points.\n");
|
||||
log_write("\t\tVolume supports reparse points.\n");
|
||||
dwFileSystemFlags -= FILE_SUPPORTS_REPARSE_POINTS;
|
||||
}
|
||||
|
||||
if(dwFileSystemFlags & (DWORD)FILE_SUPPORTS_SPARSE_FILES)
|
||||
{
|
||||
printf("\t\tVolume supports sparse files.\n");
|
||||
log_write("\t\tVolume supports sparse files.\n");
|
||||
dwFileSystemFlags -= FILE_SUPPORTS_SPARSE_FILES;
|
||||
}
|
||||
|
||||
if(dwFileSystemFlags & (DWORD)FILE_SUPPORTS_TRANSACTIONS)
|
||||
{
|
||||
printf("\t\tVolume supports transactions.\n");
|
||||
log_write("\t\tVolume supports transactions.\n");
|
||||
dwFileSystemFlags -= FILE_SUPPORTS_TRANSACTIONS;
|
||||
}
|
||||
|
||||
if(dwFileSystemFlags & (DWORD)FILE_SUPPORTS_USN_JOURNAL)
|
||||
{
|
||||
printf("\t\tVolume has an USN journal.\n");
|
||||
log_write("\t\tVolume has an USN journal.\n");
|
||||
dwFileSystemFlags -= FILE_SUPPORTS_USN_JOURNAL;
|
||||
}
|
||||
|
||||
if(dwFileSystemFlags & (DWORD)FILE_UNICODE_ON_DISK)
|
||||
{
|
||||
printf("\t\tVolume stores filenames as Unicode.\n");
|
||||
log_write("\t\tVolume stores filenames as Unicode.\n");
|
||||
dwFileSystemFlags -= FILE_UNICODE_ON_DISK;
|
||||
}
|
||||
|
||||
if(dwFileSystemFlags & (DWORD)FILE_VOLUME_IS_COMPRESSED)
|
||||
{
|
||||
printf("\t\tVolume is compressed.\n");
|
||||
log_write("\t\tVolume is compressed.\n");
|
||||
dwFileSystemFlags -= FILE_VOLUME_IS_COMPRESSED;
|
||||
}
|
||||
|
||||
if(dwFileSystemFlags & (DWORD)FILE_VOLUME_QUOTAS)
|
||||
{
|
||||
printf("\t\tVolume supports user quotas.\n");
|
||||
log_write("\t\tVolume supports user quotas.\n");
|
||||
dwFileSystemFlags -= FILE_VOLUME_QUOTAS;
|
||||
}
|
||||
|
||||
if(dwFileSystemFlags & (DWORD)FILE_RETURNS_CLEANUP_RESULT_INFO)
|
||||
{
|
||||
printf("\t\tOn a clean operation, volume returns additional information.\n");
|
||||
log_write("\t\tOn a clean operation, volume returns additional information.\n");
|
||||
dwFileSystemFlags -= FILE_RETURNS_CLEANUP_RESULT_INFO;
|
||||
}
|
||||
|
||||
if(dwFileSystemFlags & (DWORD)FILE_SUPPORTS_POSIX_UNLINK_RENAME)
|
||||
{
|
||||
printf("\t\tVolume supports POSIX-style delete and rename operations.\n");
|
||||
log_write("\t\tVolume supports POSIX-style delete and rename operations.\n");
|
||||
dwFileSystemFlags -= FILE_SUPPORTS_POSIX_UNLINK_RENAME;
|
||||
}
|
||||
|
||||
if(dwFileSystemFlags & (DWORD)FS_LFN_APIS)
|
||||
{
|
||||
printf("\t\tVolume supports LFN API.\n");
|
||||
log_write("\t\tVolume supports LFN API.\n");
|
||||
dwFileSystemFlags -= FS_LFN_APIS;
|
||||
}
|
||||
|
||||
if(dwFileSystemFlags > 0) printf("Unknown flags: 0x%08lx.\n", dwFileSystemFlags);
|
||||
if(dwFileSystemFlags > 0) log_write("Unknown flags: 0x%08lx.\n", dwFileSystemFlags);
|
||||
}
|
||||
|
||||
free(lpVolumeNameBuffer);
|
||||
@@ -275,14 +276,14 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu querying volume space.\n", error);
|
||||
log_write("Error %lu querying volume space.\n", error);
|
||||
free(lpRootPathName);
|
||||
return;
|
||||
}
|
||||
|
||||
*clusterSize = dwSectorsPerCluster * dwBytesPerSector;
|
||||
printf("\tBytes per sector: %lu\n", dwBytesPerSector);
|
||||
printf("\tSectors per cluster: %lu ("SIZE_T_FORMAT" bytes)\n", dwSectorsPerCluster, *clusterSize);
|
||||
log_write("\tBytes per sector: %lu\n", dwBytesPerSector);
|
||||
log_write("\tSectors per cluster: %lu (" SIZE_T_FORMAT " bytes)\n", dwSectorsPerCluster, *clusterSize);
|
||||
|
||||
if(WinGetVersionExA)
|
||||
{
|
||||
@@ -292,7 +293,7 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu querying Windows version.\n", error);
|
||||
log_write("Error %lu querying Windows version.\n", error);
|
||||
free(lpRootPathName);
|
||||
return;
|
||||
}
|
||||
@@ -320,13 +321,13 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu querying extended volume space.\n", error);
|
||||
log_write("Error %lu querying extended volume space.\n", error);
|
||||
free(lpRootPathName);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("\tVolume size: %I64d bytes\n", qwTotalNumberOfBytes.QuadPart);
|
||||
printf("\tVolume free: %I64d bytes\n", qwTotalNumberOfFreeBytes.QuadPart);
|
||||
log_write("\tVolume size: %I64d bytes\n", qwTotalNumberOfBytes.QuadPart);
|
||||
log_write("\tVolume free: %I64d bytes\n", qwTotalNumberOfFreeBytes.QuadPart);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -335,8 +336,8 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
|
||||
qwTotalNumberOfBytes.QuadPart *= *clusterSize;
|
||||
qwTotalNumberOfFreeBytes.QuadPart *= *clusterSize;
|
||||
|
||||
printf("\tClusters: %lu (%I64d bytes)\n", dwTotalNumberOfClusters, qwTotalNumberOfBytes.QuadPart);
|
||||
printf("\tFree clusters: %lu (%I64d bytes)\n", dwNumberOfFreeClusters, qwTotalNumberOfFreeBytes.QuadPart);
|
||||
log_write("\tClusters: %lu (%I64d bytes)\n", dwTotalNumberOfClusters, qwTotalNumberOfBytes.QuadPart);
|
||||
log_write("\tFree clusters: %lu (%I64d bytes)\n", dwNumberOfFreeClusters, qwTotalNumberOfFreeBytes.QuadPart);
|
||||
}
|
||||
|
||||
free(lpRootPathName);
|
||||
|
||||
@@ -37,6 +37,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
#include "xattr.h"
|
||||
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
|
||||
extern DWORD oldVersion;
|
||||
|
||||
@@ -66,7 +67,7 @@ void ExtendedAttributes(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu querying Windows version.\n", error);
|
||||
log_write("Error %lu querying Windows version.\n", error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -84,7 +85,7 @@ void ExtendedAttributes(const char* path)
|
||||
if(ntdll == NULL)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu loading NTDLL.DLL.\n", error);
|
||||
log_write("Error %lu loading NTDLL.DLL.\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -93,7 +94,7 @@ void ExtendedAttributes(const char* path)
|
||||
if(func == NULL)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu finding NtSetEaFile.\n", error);
|
||||
log_write("Error %lu finding NtSetEaFile.\n", error);
|
||||
FreeLibrary(ntdll);
|
||||
return;
|
||||
}
|
||||
@@ -105,7 +106,7 @@ void ExtendedAttributes(const char* path)
|
||||
if(func == NULL)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu finding NtQueryEaFile.\n", error);
|
||||
log_write("Error %lu finding NtQueryEaFile.\n", error);
|
||||
FreeLibrary(ntdll);
|
||||
return;
|
||||
}
|
||||
@@ -116,7 +117,7 @@ void ExtendedAttributes(const char* path)
|
||||
|
||||
if(!lpRootPathName)
|
||||
{
|
||||
printf("Could not allocate memory.\n");
|
||||
log_write("Could not allocate memory.\n");
|
||||
FreeLibrary(ntdll);
|
||||
return;
|
||||
}
|
||||
@@ -131,7 +132,7 @@ void ExtendedAttributes(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu changing to specified path.\n", error);
|
||||
log_write("Error %lu changing to specified path.\n", error);
|
||||
FreeLibrary(ntdll);
|
||||
return;
|
||||
}
|
||||
@@ -141,7 +142,7 @@ void ExtendedAttributes(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu creating working directory.\n", error);
|
||||
log_write("Error %lu creating working directory.\n", error);
|
||||
FreeLibrary(ntdll);
|
||||
return;
|
||||
}
|
||||
@@ -151,12 +152,12 @@ void ExtendedAttributes(const char* path)
|
||||
if(!ret)
|
||||
{
|
||||
error = GetLastError();
|
||||
printf("Error %lu changing to working directory.\n", error);
|
||||
log_write("Error %lu changing to working directory.\n", error);
|
||||
FreeLibrary(ntdll);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Creating files with extended attributes.\n");
|
||||
log_write("Creating files with extended attributes.\n");
|
||||
|
||||
rRc = 0;
|
||||
cmp = TRUE;
|
||||
@@ -209,13 +210,13 @@ void ExtendedAttributes(const char* path)
|
||||
if(!ret) cRc = GetLastError();
|
||||
}
|
||||
|
||||
printf("\tFile with comments = \"%s\", rc = 0x%08lx, wRc = %lu, cRc = %lu, rRc = %lu, cmp = %d\n",
|
||||
"COMMENTS",
|
||||
rc,
|
||||
wRc,
|
||||
cRc,
|
||||
rRc,
|
||||
cmp);
|
||||
log_write("\tFile with comments = \"%s\", rc = 0x%08lx, wRc = %lu, cRc = %lu, rRc = %lu, cmp = %d\n",
|
||||
"COMMENTS",
|
||||
rc,
|
||||
wRc,
|
||||
cRc,
|
||||
rRc,
|
||||
cmp);
|
||||
|
||||
rRc = 0;
|
||||
cmp = TRUE;
|
||||
@@ -268,13 +269,13 @@ void ExtendedAttributes(const char* path)
|
||||
if(!ret) cRc = GetLastError();
|
||||
}
|
||||
|
||||
printf("\tFile with comments = \"%s\", rc = 0x%08lx, wRc = %lu, cRc = %lu, rRc = %lu, cmp = %d\n",
|
||||
"COMMENTS.CRT",
|
||||
rc,
|
||||
wRc,
|
||||
cRc,
|
||||
rRc,
|
||||
cmp);
|
||||
log_write("\tFile with comments = \"%s\", rc = 0x%08lx, wRc = %lu, cRc = %lu, rRc = %lu, cmp = %d\n",
|
||||
"COMMENTS.CRT",
|
||||
rc,
|
||||
wRc,
|
||||
cRc,
|
||||
rRc,
|
||||
cmp);
|
||||
|
||||
rRc = 0;
|
||||
cmp = TRUE;
|
||||
@@ -327,13 +328,13 @@ void ExtendedAttributes(const char* path)
|
||||
if(!ret) cRc = GetLastError();
|
||||
}
|
||||
|
||||
printf("\tFile with icon = \"%s\", rc = 0x%08lx, wRc = %lu, cRc = %lu, rRc = %lu, cmp = %d\n",
|
||||
"ICON",
|
||||
rc,
|
||||
wRc,
|
||||
cRc,
|
||||
rRc,
|
||||
cmp);
|
||||
log_write("\tFile with icon = \"%s\", rc = 0x%08lx, wRc = %lu, cRc = %lu, rRc = %lu, cmp = %d\n",
|
||||
"ICON",
|
||||
rc,
|
||||
wRc,
|
||||
cRc,
|
||||
rRc,
|
||||
cmp);
|
||||
|
||||
FreeLibrary(ntdll);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user