mirror of
https://github.com/aaru-dps/fstester.git
synced 2025-12-16 19:24:39 +00:00
Fix win32 definitions.
This commit is contained in:
@@ -44,13 +44,9 @@ Copyright (C) 2011-2021 Natalia Portillo
|
|||||||
|
|
||||||
#include "attr.h"
|
#include "attr.h"
|
||||||
|
|
||||||
#include "../include/consts.h"
|
|
||||||
#include "../include/defs.h"
|
#include "../include/defs.h"
|
||||||
|
|
||||||
static DWORD dwMaxNameSize = MAX_PATH + 1;
|
extern DWORD oldVersion;
|
||||||
static DWORD dwFilePermissions = GENERIC_READ | GENERIC_WRITE;
|
|
||||||
static DWORD oldVersion;
|
|
||||||
static HINSTANCE kernel32;
|
|
||||||
|
|
||||||
void FileAttributes(const char* path)
|
void FileAttributes(const char* path)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,14 +41,8 @@ Copyright (C) 2011-2021 Natalia Portillo
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "win32.h"
|
#include "win32.h"
|
||||||
#include "../include/consts.h"
|
|
||||||
#include "../include/defs.h"
|
#include "../include/defs.h"
|
||||||
|
|
||||||
static DWORD dwMaxNameSize = MAX_PATH + 1;
|
|
||||||
static DWORD dwFilePermissions = GENERIC_READ | GENERIC_WRITE;
|
|
||||||
static DWORD oldVersion;
|
|
||||||
static HINSTANCE kernel32;
|
|
||||||
|
|
||||||
void DeleteFiles(const char* path)
|
void DeleteFiles(const char* path)
|
||||||
{
|
{
|
||||||
char filename[9];
|
char filename[9];
|
||||||
|
|||||||
@@ -41,14 +41,8 @@ Copyright (C) 2011-2021 Natalia Portillo
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "win32.h"
|
#include "win32.h"
|
||||||
#include "../include/consts.h"
|
|
||||||
#include "../include/defs.h"
|
#include "../include/defs.h"
|
||||||
|
|
||||||
static DWORD dwMaxNameSize = MAX_PATH + 1;
|
|
||||||
static DWORD dwFilePermissions = GENERIC_READ | GENERIC_WRITE;
|
|
||||||
static DWORD oldVersion;
|
|
||||||
static HINSTANCE kernel32;
|
|
||||||
|
|
||||||
void DirectoryDepth(const char* path)
|
void DirectoryDepth(const char* path)
|
||||||
{
|
{
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
|||||||
@@ -44,11 +44,6 @@ Copyright (C) 2011-2021 Natalia Portillo
|
|||||||
#include "../include/consts.h"
|
#include "../include/consts.h"
|
||||||
#include "../include/defs.h"
|
#include "../include/defs.h"
|
||||||
|
|
||||||
static DWORD dwMaxNameSize = MAX_PATH + 1;
|
|
||||||
static DWORD dwFilePermissions = GENERIC_READ | GENERIC_WRITE;
|
|
||||||
static DWORD oldVersion;
|
|
||||||
static HINSTANCE kernel32;
|
|
||||||
|
|
||||||
void Filenames(const char* path)
|
void Filenames(const char* path)
|
||||||
{
|
{
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
|||||||
@@ -41,14 +41,8 @@ Copyright (C) 2011-2021 Natalia Portillo
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "win32.h"
|
#include "win32.h"
|
||||||
#include "../include/consts.h"
|
|
||||||
#include "../include/defs.h"
|
#include "../include/defs.h"
|
||||||
|
|
||||||
static DWORD dwMaxNameSize = MAX_PATH + 1;
|
|
||||||
static DWORD dwFilePermissions = GENERIC_READ | GENERIC_WRITE;
|
|
||||||
static DWORD oldVersion;
|
|
||||||
static HINSTANCE kernel32;
|
|
||||||
|
|
||||||
void MillionFiles(const char* path)
|
void MillionFiles(const char* path)
|
||||||
{
|
{
|
||||||
char filename[9];
|
char filename[9];
|
||||||
|
|||||||
@@ -44,11 +44,6 @@ Copyright (C) 2011-2021 Natalia Portillo
|
|||||||
#include "../include/consts.h"
|
#include "../include/consts.h"
|
||||||
#include "../include/defs.h"
|
#include "../include/defs.h"
|
||||||
|
|
||||||
static DWORD dwMaxNameSize = MAX_PATH + 1;
|
|
||||||
static DWORD dwFilePermissions = GENERIC_READ | GENERIC_WRITE;
|
|
||||||
static DWORD oldVersion;
|
|
||||||
static HINSTANCE kernel32;
|
|
||||||
|
|
||||||
void Fragmentation(const char* path, size_t clusterSize)
|
void Fragmentation(const char* path, size_t clusterSize)
|
||||||
{
|
{
|
||||||
size_t halfCluster = clusterSize / 2;
|
size_t halfCluster = clusterSize / 2;
|
||||||
|
|||||||
@@ -44,13 +44,9 @@ Copyright (C) 2011-2021 Natalia Portillo
|
|||||||
|
|
||||||
#include "links.h"
|
#include "links.h"
|
||||||
|
|
||||||
#include "../include/consts.h"
|
|
||||||
#include "../include/defs.h"
|
#include "../include/defs.h"
|
||||||
|
|
||||||
static DWORD dwMaxNameSize = MAX_PATH + 1;
|
extern DWORD oldVersion;
|
||||||
static DWORD dwFilePermissions = GENERIC_READ | GENERIC_WRITE;
|
|
||||||
static DWORD oldVersion;
|
|
||||||
static HINSTANCE kernel32;
|
|
||||||
|
|
||||||
void Links(const char* path)
|
void Links(const char* path)
|
||||||
{
|
{
|
||||||
@@ -64,6 +60,7 @@ void Links(const char* path)
|
|||||||
HANDLE h;
|
HANDLE h;
|
||||||
LPSTR lpRootPathName;
|
LPSTR lpRootPathName;
|
||||||
size_t pathSize = strlen(path);
|
size_t pathSize = strlen(path);
|
||||||
|
HINSTANCE kernel32;
|
||||||
|
|
||||||
if(WinGetVersionExA)
|
if(WinGetVersionExA)
|
||||||
{
|
{
|
||||||
@@ -216,6 +213,8 @@ void Links(const char* path)
|
|||||||
|
|
||||||
printf("\tHard link, rc = 0x%08lx, wRc = %lu, cRc = %lu, lRc = %lu\n", rc, wRc, cRc, lRc);
|
printf("\tHard link, rc = 0x%08lx, wRc = %lu, cRc = %lu, lRc = %lu\n", rc, wRc, cRc, lRc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FreeLibrary(kernel32);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#ifndef SETTER_SRC_WIN32_LINKS_H_
|
#ifndef SETTER_SRC_WIN32_LINKS_H_
|
||||||
#define SETTER_SRC_WIN32_LINKS_H_
|
#define SETTER_SRC_WIN32_LINKS_H_
|
||||||
|
|
||||||
BOOL(WINAPI* WinNtCreateHardLinkA)(LPCSTR, LPCSTR, LPSECURITY_ATTRIBUTES);
|
static BOOL(WINAPI* WinNtCreateHardLinkA)(LPCSTR, LPCSTR, LPSECURITY_ATTRIBUTES);
|
||||||
BOOL(WINAPI* WinNtCreateSymbolicLinkA)(LPCSTR, LPCSTR, DWORD);
|
static BOOL(WINAPI* WinNtCreateSymbolicLinkA)(LPCSTR, LPCSTR, DWORD);
|
||||||
|
|
||||||
#endif // SETTER_SRC_WIN32_LINKS_H_
|
#endif // SETTER_SRC_WIN32_LINKS_H_
|
||||||
|
|||||||
@@ -37,17 +37,12 @@ Copyright (C) 2011-2021 Natalia Portillo
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "win32.h"
|
#include "win32.h"
|
||||||
#include "../include/consts.h"
|
|
||||||
#include "../include/defs.h"
|
#include "../include/defs.h"
|
||||||
|
|
||||||
static DWORD dwMaxNameSize = MAX_PATH + 1;
|
DWORD oldVersion;
|
||||||
static DWORD dwFilePermissions = GENERIC_READ | GENERIC_WRITE;
|
|
||||||
static DWORD oldVersion;
|
|
||||||
static HINSTANCE kernel32;
|
|
||||||
|
|
||||||
void GetOsInfo()
|
void GetOsInfo()
|
||||||
{
|
{
|
||||||
@@ -55,6 +50,7 @@ void GetOsInfo()
|
|||||||
BOOL ret;
|
BOOL ret;
|
||||||
DWORD error;
|
DWORD error;
|
||||||
void* func;
|
void* func;
|
||||||
|
HINSTANCE kernel32;
|
||||||
kernel32 = LoadLibraryA("KERNEL32.DLL");
|
kernel32 = LoadLibraryA("KERNEL32.DLL");
|
||||||
|
|
||||||
memset(&verInfo, 0, sizeof(WIN_OSVERSIONINFO));
|
memset(&verInfo, 0, sizeof(WIN_OSVERSIONINFO));
|
||||||
@@ -90,6 +86,8 @@ void GetOsInfo()
|
|||||||
else
|
else
|
||||||
printf("\tRunning under Windows NT %lu.%lu.\n", verInfo.dwMajorVersion, verInfo.dwMinorVersion);
|
printf("\tRunning under Windows NT %lu.%lu.\n", verInfo.dwMajorVersion, verInfo.dwMinorVersion);
|
||||||
|
|
||||||
|
FreeLibrary(kernel32);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,6 +100,7 @@ void GetOsInfo()
|
|||||||
{
|
{
|
||||||
error = GetLastError();
|
error = GetLastError();
|
||||||
printf("Error %lu querying Windows version.\n", error);
|
printf("Error %lu querying Windows version.\n", error);
|
||||||
|
FreeLibrary(kernel32);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,6 +194,8 @@ void GetOsInfo()
|
|||||||
printf(" version %lu%02lud.\n", verInfo.dwMajorVersion, verInfo.dwMinorVersion);
|
printf(" version %lu%02lud.\n", verInfo.dwMajorVersion, verInfo.dwMinorVersion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FreeLibrary(kernel32);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -34,21 +34,8 @@ Copyright (C) 2011-2021 Natalia Portillo
|
|||||||
|
|
||||||
#define _CRT_SECURE_NO_WARNINGS 1
|
#define _CRT_SECURE_NO_WARNINGS 1
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "win32.h"
|
|
||||||
#include "../include/consts.h"
|
|
||||||
#include "../include/defs.h"
|
#include "../include/defs.h"
|
||||||
|
|
||||||
static DWORD dwMaxNameSize = MAX_PATH + 1;
|
|
||||||
static DWORD dwFilePermissions = GENERIC_READ | GENERIC_WRITE;
|
|
||||||
static DWORD oldVersion;
|
|
||||||
static HINSTANCE kernel32;
|
|
||||||
|
|
||||||
void FilePermissions(const char* path)
|
void FilePermissions(const char* path)
|
||||||
{ /* Do nothing, not supported by target operating system */
|
{ /* Do nothing, not supported by target operating system */
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,13 +44,9 @@ Copyright (C) 2011-2021 Natalia Portillo
|
|||||||
|
|
||||||
#include "rsrcfork.h"
|
#include "rsrcfork.h"
|
||||||
|
|
||||||
#include "../include/consts.h"
|
|
||||||
#include "../include/defs.h"
|
#include "../include/defs.h"
|
||||||
|
|
||||||
static DWORD dwMaxNameSize = MAX_PATH + 1;
|
extern DWORD oldVersion;
|
||||||
static DWORD dwFilePermissions = GENERIC_READ | GENERIC_WRITE;
|
|
||||||
static DWORD oldVersion;
|
|
||||||
static HINSTANCE kernel32;
|
|
||||||
|
|
||||||
void ResourceFork(const char* path)
|
void ResourceFork(const char* path)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,11 +44,6 @@ Copyright (C) 2011-2021 Natalia Portillo
|
|||||||
#include "../include/consts.h"
|
#include "../include/consts.h"
|
||||||
#include "../include/defs.h"
|
#include "../include/defs.h"
|
||||||
|
|
||||||
static DWORD dwMaxNameSize = MAX_PATH + 1;
|
|
||||||
static DWORD dwFilePermissions = GENERIC_READ | GENERIC_WRITE;
|
|
||||||
static DWORD oldVersion;
|
|
||||||
static HINSTANCE kernel32;
|
|
||||||
|
|
||||||
void Sparse(const char* path)
|
void Sparse(const char* path)
|
||||||
{
|
{
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
|||||||
@@ -41,14 +41,8 @@ Copyright (C) 2011-2021 Natalia Portillo
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "win32.h"
|
#include "win32.h"
|
||||||
#include "../include/consts.h"
|
|
||||||
#include "../include/defs.h"
|
#include "../include/defs.h"
|
||||||
|
|
||||||
static DWORD dwMaxNameSize = MAX_PATH + 1;
|
|
||||||
static DWORD dwFilePermissions = GENERIC_READ | GENERIC_WRITE;
|
|
||||||
static DWORD oldVersion;
|
|
||||||
static HINSTANCE kernel32;
|
|
||||||
|
|
||||||
void Timestamps(const char* path)
|
void Timestamps(const char* path)
|
||||||
{
|
{
|
||||||
char message[300];
|
char message[300];
|
||||||
|
|||||||
@@ -44,13 +44,9 @@ Copyright (C) 2011-2021 Natalia Portillo
|
|||||||
|
|
||||||
#include "volume.h"
|
#include "volume.h"
|
||||||
|
|
||||||
#include "../include/consts.h"
|
|
||||||
#include "../include/defs.h"
|
#include "../include/defs.h"
|
||||||
|
|
||||||
static DWORD dwMaxNameSize = MAX_PATH + 1;
|
extern DWORD oldVersion;
|
||||||
static DWORD dwFilePermissions = GENERIC_READ | GENERIC_WRITE;
|
|
||||||
static DWORD oldVersion;
|
|
||||||
static HINSTANCE kernel32;
|
|
||||||
|
|
||||||
void GetVolumeInfo(const char* path, size_t* clusterSize)
|
void GetVolumeInfo(const char* path, size_t* clusterSize)
|
||||||
{
|
{
|
||||||
@@ -71,6 +67,7 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
|
|||||||
ULARGE_INTEGER qwTotalNumberOfBytes;
|
ULARGE_INTEGER qwTotalNumberOfBytes;
|
||||||
ULARGE_INTEGER qwTotalNumberOfFreeBytes;
|
ULARGE_INTEGER qwTotalNumberOfFreeBytes;
|
||||||
void* func;
|
void* func;
|
||||||
|
HINSTANCE kernel32;
|
||||||
|
|
||||||
*clusterSize = 0;
|
*clusterSize = 0;
|
||||||
|
|
||||||
@@ -314,8 +311,13 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
|
|||||||
if(verInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS && verInfo.dwBuildNumber >= 1000 ||
|
if(verInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS && verInfo.dwBuildNumber >= 1000 ||
|
||||||
verInfo.dwPlatformId == VER_PLATFORM_WIN32_NT && kernel32)
|
verInfo.dwPlatformId == VER_PLATFORM_WIN32_NT && kernel32)
|
||||||
{
|
{
|
||||||
func = GetProcAddress(kernel32, "GetDiskFreeSpaceExA");
|
kernel32 = LoadLibraryA("kernel32.dll");
|
||||||
if(func) WinGetDiskFreeSpaceExA = func;
|
|
||||||
|
if(kernel32)
|
||||||
|
{
|
||||||
|
func = GetProcAddress(kernel32, "GetDiskFreeSpaceExA");
|
||||||
|
if(func) WinGetDiskFreeSpaceExA = func;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(WinGetDiskFreeSpaceExA)
|
if(WinGetDiskFreeSpaceExA)
|
||||||
@@ -346,6 +348,8 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
free(lpRootPathName);
|
free(lpRootPathName);
|
||||||
|
|
||||||
|
if(func) FreeLibrary(kernel32);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -256,6 +256,9 @@ typedef WIN_LPOSVERSIONINFOA WIN_LPOSVERSIONINFO;
|
|||||||
|
|
||||||
static BOOL(WINAPI* WinGetVersionExA)(WIN_LPOSVERSIONINFOA);
|
static BOOL(WINAPI* WinGetVersionExA)(WIN_LPOSVERSIONINFOA);
|
||||||
|
|
||||||
|
static DWORD dwMaxNameSize = MAX_PATH + 1;
|
||||||
|
static DWORD dwFilePermissions = GENERIC_READ | GENERIC_WRITE;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -44,13 +44,9 @@ Copyright (C) 2011-2021 Natalia Portillo
|
|||||||
|
|
||||||
#include "xattr.h"
|
#include "xattr.h"
|
||||||
|
|
||||||
#include "../include/consts.h"
|
|
||||||
#include "../include/defs.h"
|
#include "../include/defs.h"
|
||||||
|
|
||||||
static DWORD dwMaxNameSize = MAX_PATH + 1;
|
extern DWORD oldVersion;
|
||||||
static DWORD dwFilePermissions = GENERIC_READ | GENERIC_WRITE;
|
|
||||||
static DWORD oldVersion;
|
|
||||||
static HINSTANCE kernel32;
|
|
||||||
|
|
||||||
void ExtendedAttributes(const char* path)
|
void ExtendedAttributes(const char* path)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ unsigned char IconEA[3516] = {
|
|||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00};
|
0x00};
|
||||||
|
|
||||||
NTSTATUS(NTAPI* NtSetEaFile)(HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG);
|
static NTSTATUS(NTAPI* NtSetEaFile)(HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG);
|
||||||
NTSTATUS(NTAPI* NtQueryEaFile)(HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG, BOOLEAN, PVOID, ULONG, PULONG, BOOLEAN);
|
static NTSTATUS(NTAPI* NtQueryEaFile)(HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG, BOOLEAN, PVOID, ULONG, PULONG, BOOLEAN);
|
||||||
|
|
||||||
#endif // SETTER_SRC_WIN32_XATTR_H_
|
#endif // SETTER_SRC_WIN32_XATTR_H_
|
||||||
|
|||||||
Reference in New Issue
Block a user