mirror of
https://github.com/aaru-dps/fstester.git
synced 2025-12-16 19:24:39 +00:00
Move win32 definitions to nearest include.
This commit is contained in:
@@ -7,7 +7,7 @@ project(
|
||||
DESCRIPTION "Filesystem test creator for 32-bit and 64-bit Windows"
|
||||
LANGUAGES C)
|
||||
|
||||
set(PLATFORM_SOURCES attr.c deleted.c dirdepth.c filename.c files.c frag.c links.c os.c perms.c rsrcfork.c sparse.c time.c volume.c xattr.c attr.h rsrcfork.h xattr.h links.h volume.h time.h)
|
||||
set(PLATFORM_SOURCES attr.c deleted.c dirdepth.c filename.c files.c frag.c links.c os.c perms.c rsrcfork.c sparse.c time.c volume.c xattr.c attr.h rsrcfork.h xattr.h links.h volume.h time.h os.h sparse.h)
|
||||
|
||||
set(EXECUTABLE_NAME "fssetter-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "win32.h"
|
||||
|
||||
const char* compressedAttributeText = "This file is compressed.\n";
|
||||
|
||||
typedef struct
|
||||
@@ -372,4 +374,12 @@ static const win32_attr_tests_t encrypted_win32_attrs[KNOWN_WIN32_ATTRS] = {
|
||||
|
||||
BOOL(WINAPI* WinNtEncryptFileA)(LPCSTR);
|
||||
|
||||
#ifndef FSCTL_SET_COMPRESSION
|
||||
#define FSCTL_SET_COMPRESSION 0x9C040
|
||||
#endif
|
||||
|
||||
#ifndef COMPRESSION_FORMAT_DEFAULT
|
||||
#define COMPRESSION_FORMAT_DEFAULT 1
|
||||
#endif
|
||||
|
||||
#endif // SETTER_SRC_WIN32_ATTR_H_
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#ifndef SETTER_SRC_WIN32_LINKS_H_
|
||||
#define SETTER_SRC_WIN32_LINKS_H_
|
||||
|
||||
#include "win32.h"
|
||||
|
||||
static BOOL(WINAPI* WinNtCreateHardLinkA)(LPCSTR, LPCSTR, LPSECURITY_ATTRIBUTES);
|
||||
static BOOL(WINAPI* WinNtCreateSymbolicLinkA)(LPCSTR, LPCSTR, DWORD);
|
||||
|
||||
|
||||
@@ -40,6 +40,9 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
#include <string.h>
|
||||
|
||||
#include "win32.h"
|
||||
|
||||
#include "os.h"
|
||||
|
||||
#include "../include/defs.h"
|
||||
|
||||
DWORD oldVersion;
|
||||
|
||||
24
setter/src/win32/os.h
Normal file
24
setter/src/win32/os.h
Normal file
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// Created by claunia on 11/3/21.
|
||||
//
|
||||
|
||||
#ifndef SETTER_SRC_WIN32_OS_H_
|
||||
#define SETTER_SRC_WIN32_OS_H_
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "win32.h"
|
||||
|
||||
#ifndef VER_PLATFORM_WIN32s
|
||||
#define VER_PLATFORM_WIN32s 0
|
||||
#endif
|
||||
|
||||
#ifndef VER_PLATFORM_WIN32_WINDOWS
|
||||
#define VER_PLATFORM_WIN32_WINDOWS 1
|
||||
#endif
|
||||
|
||||
#ifndef VER_PLATFORM_WIN32_NT
|
||||
#define VER_PLATFORM_WIN32_NT 2
|
||||
#endif
|
||||
|
||||
#endif // SETTER_SRC_WIN32_OS_H_
|
||||
@@ -41,6 +41,9 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
#include <string.h>
|
||||
|
||||
#include "win32.h"
|
||||
|
||||
#include "sparse.h"
|
||||
|
||||
#include "../include/consts.h"
|
||||
#include "../include/defs.h"
|
||||
|
||||
|
||||
29
setter/src/win32/sparse.h
Normal file
29
setter/src/win32/sparse.h
Normal file
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// Created by claunia on 11/3/21.
|
||||
//
|
||||
|
||||
#ifndef SETTER_SRC_WIN32_SPARSE_H_
|
||||
#define SETTER_SRC_WIN32_SPARSE_H_
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "win32.h"
|
||||
|
||||
#ifndef FSCTL_SET_SPARSE
|
||||
#define FSCTL_SET_SPARSE 0x000900C4
|
||||
#endif
|
||||
|
||||
#ifndef FSCTL_SET_ZERO_DATA
|
||||
#define FSCTL_SET_ZERO_DATA 0x000900C8
|
||||
#endif
|
||||
|
||||
#define FSCTL_SET_SPARSE_OLD 0x000980C4
|
||||
#define FSCTL_SET_ZERO_DATA_OLD 0x000980C8
|
||||
|
||||
typedef struct _WINNT_FILE_ZERO_DATA_INFORMATION
|
||||
{
|
||||
LARGE_INTEGER FileOffset;
|
||||
LARGE_INTEGER BeyondFinalZero;
|
||||
} WINNT_FILE_ZERO_DATA_INFORMATION, *PWINNT_FILE_ZERO_DATA_INFORMATION;
|
||||
|
||||
#endif // SETTER_SRC_WIN32_SPARSE_H_
|
||||
@@ -5,6 +5,138 @@
|
||||
#ifndef SETTER_SRC_WIN32_VOLUME_H_
|
||||
#define SETTER_SRC_WIN32_VOLUME_H_
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "win32.h"
|
||||
|
||||
BOOL(WINAPI* WinGetDiskFreeSpaceExA)(LPCSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER);
|
||||
|
||||
#ifndef FILE_CASE_PRESERVED_NAMES
|
||||
#define FILE_CASE_PRESERVED_NAMES 0x00000002
|
||||
#endif
|
||||
|
||||
#ifndef FILE_CASE_SENSITIVE_SEARCH
|
||||
#define FILE_CASE_SENSITIVE_SEARCH 0x00000001
|
||||
#endif
|
||||
|
||||
#ifndef FILE_DAX_VOLUME
|
||||
#define FILE_DAX_VOLUME 0x20000000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_FILE_COMPRESSION
|
||||
#define FILE_FILE_COMPRESSION 0x00000010
|
||||
#endif
|
||||
|
||||
#ifndef FILE_NAMED_STREAMS
|
||||
#define FILE_NAMED_STREAMS 0x00040000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_PERSISTENT_ACLS
|
||||
#define FILE_PERSISTENT_ACLS 0x00000008
|
||||
#endif
|
||||
|
||||
#ifndef FILE_READ_ONLY_VOLUME
|
||||
#define FILE_READ_ONLY_VOLUME 0x00080000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_SEQUENTIAL_WRITE_ONCE
|
||||
#define FILE_SEQUENTIAL_WRITE_ONCE 0x00100000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_SUPPORTS_ENCRYPTION
|
||||
#define FILE_SUPPORTS_ENCRYPTION 0x00020000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_SUPPORTS_EXTENDED_ATTRIBUTES
|
||||
#define FILE_SUPPORTS_EXTENDED_ATTRIBUTES 0x00800000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_SUPPORTS_HARD_LINKS
|
||||
#define FILE_SUPPORTS_HARD_LINKS 0x00400000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_SUPPORTS_OBJECT_IDS
|
||||
#define FILE_SUPPORTS_OBJECT_IDS 0x00010000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_SUPPORTS_OPEN_BY_FILE_ID
|
||||
#define FILE_SUPPORTS_OPEN_BY_FILE_ID 0x01000000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_SUPPORTS_REPARSE_POINTS
|
||||
#define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
|
||||
#endif
|
||||
|
||||
#ifndef FILE_SUPPORTS_SPARSE_FILES
|
||||
#define FILE_SUPPORTS_SPARSE_FILES 0x00000040
|
||||
#endif
|
||||
|
||||
#ifndef FILE_SUPPORTS_TRANSACTIONS
|
||||
#define FILE_SUPPORTS_TRANSACTIONS 0x00200000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_SUPPORTS_USN_JOURNAL
|
||||
#define FILE_SUPPORTS_USN_JOURNAL 0x02000000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_UNICODE_ON_DISK
|
||||
#define FILE_UNICODE_ON_DISK 0x00000004
|
||||
#endif
|
||||
|
||||
#ifndef FILE_VOLUME_IS_COMPRESSED
|
||||
#define FILE_VOLUME_IS_COMPRESSED 0x00008000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_VOLUME_QUOTAS
|
||||
#define FILE_VOLUME_QUOTAS 0x00000020
|
||||
#endif
|
||||
|
||||
#ifndef FILE_ATTRIBUTE_ARCHIVE
|
||||
#define FILE_ATTRIBUTE_ARCHIVE 0x00000020
|
||||
#endif
|
||||
|
||||
#ifndef FILE_ATTRIBUTE_ENCRYPTED
|
||||
#define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_ATTRIBUTE_HIDDEN
|
||||
#define FILE_ATTRIBUTE_HIDDEN 0x00000002
|
||||
#endif
|
||||
|
||||
#ifndef FILE_ATTRIBUTE_NORMAL
|
||||
#define FILE_ATTRIBUTE_NORMAL 0x00000080
|
||||
#endif
|
||||
|
||||
#ifndef FILE_ATTRIBUTE_OFFLINE
|
||||
#define FILE_ATTRIBUTE_OFFLINE 0x00001000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_ATTRIBUTE_READONLY
|
||||
#define FILE_ATTRIBUTE_READONLY 0x00000001
|
||||
#endif
|
||||
|
||||
#ifndef FILE_ATTRIBUTE_SYSTEM
|
||||
#define FILE_ATTRIBUTE_SYSTEM 0x00000004
|
||||
#endif
|
||||
|
||||
#ifndef FILE_ATTRIBUTE_TEMPORARY
|
||||
#define FILE_ATTRIBUTE_TEMPORARY 0x00000100
|
||||
#endif
|
||||
|
||||
#ifndef FILE_ATTRIBUTE_COMPRESSED
|
||||
#define FILE_ATTRIBUTE_COMPRESSED 0x00000800
|
||||
#endif
|
||||
|
||||
#ifndef FILE_RETURNS_CLEANUP_RESULT_INFO
|
||||
#define FILE_RETURNS_CLEANUP_RESULT_INFO 0x00000200
|
||||
#endif
|
||||
|
||||
#ifndef FILE_SUPPORTS_POSIX_UNLINK_RENAME
|
||||
#define FILE_SUPPORTS_POSIX_UNLINK_RENAME 0x00000400
|
||||
#endif
|
||||
|
||||
#ifndef FS_LFN_APIS
|
||||
#define FS_LFN_APIS 0x00004000
|
||||
#endif
|
||||
|
||||
#endif // SETTER_SRC_WIN32_VOLUME_H_
|
||||
|
||||
@@ -35,200 +35,12 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#ifndef VER_PLATFORM_WIN32s
|
||||
#define VER_PLATFORM_WIN32s 0
|
||||
#endif
|
||||
|
||||
#ifndef VER_PLATFORM_WIN32_WINDOWS
|
||||
#define VER_PLATFORM_WIN32_WINDOWS 1
|
||||
#endif
|
||||
|
||||
#ifndef VER_PLATFORM_WIN32_NT
|
||||
#define VER_PLATFORM_WIN32_NT 2
|
||||
#endif
|
||||
|
||||
#ifndef FILE_CASE_PRESERVED_NAMES
|
||||
#define FILE_CASE_PRESERVED_NAMES 0x00000002
|
||||
#endif
|
||||
|
||||
#ifndef FILE_CASE_SENSITIVE_SEARCH
|
||||
#define FILE_CASE_SENSITIVE_SEARCH 0x00000001
|
||||
#endif
|
||||
|
||||
#ifndef FILE_DAX_VOLUME
|
||||
#define FILE_DAX_VOLUME 0x20000000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_FILE_COMPRESSION
|
||||
#define FILE_FILE_COMPRESSION 0x00000010
|
||||
#endif
|
||||
|
||||
#ifndef FILE_NAMED_STREAMS
|
||||
#define FILE_NAMED_STREAMS 0x00040000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_PERSISTENT_ACLS
|
||||
#define FILE_PERSISTENT_ACLS 0x00000008
|
||||
#endif
|
||||
|
||||
#ifndef FILE_READ_ONLY_VOLUME
|
||||
#define FILE_READ_ONLY_VOLUME 0x00080000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_SEQUENTIAL_WRITE_ONCE
|
||||
#define FILE_SEQUENTIAL_WRITE_ONCE 0x00100000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_SUPPORTS_ENCRYPTION
|
||||
#define FILE_SUPPORTS_ENCRYPTION 0x00020000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_SUPPORTS_EXTENDED_ATTRIBUTES
|
||||
#define FILE_SUPPORTS_EXTENDED_ATTRIBUTES 0x00800000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_SUPPORTS_HARD_LINKS
|
||||
#define FILE_SUPPORTS_HARD_LINKS 0x00400000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_SUPPORTS_OBJECT_IDS
|
||||
#define FILE_SUPPORTS_OBJECT_IDS 0x00010000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_SUPPORTS_OPEN_BY_FILE_ID
|
||||
#define FILE_SUPPORTS_OPEN_BY_FILE_ID 0x01000000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_SUPPORTS_REPARSE_POINTS
|
||||
#define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
|
||||
#endif
|
||||
|
||||
#ifndef FILE_SUPPORTS_SPARSE_FILES
|
||||
#define FILE_SUPPORTS_SPARSE_FILES 0x00000040
|
||||
#endif
|
||||
|
||||
#ifndef FILE_SUPPORTS_TRANSACTIONS
|
||||
#define FILE_SUPPORTS_TRANSACTIONS 0x00200000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_SUPPORTS_USN_JOURNAL
|
||||
#define FILE_SUPPORTS_USN_JOURNAL 0x02000000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_UNICODE_ON_DISK
|
||||
#define FILE_UNICODE_ON_DISK 0x00000004
|
||||
#endif
|
||||
|
||||
#ifndef FILE_VOLUME_IS_COMPRESSED
|
||||
#define FILE_VOLUME_IS_COMPRESSED 0x00008000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_VOLUME_QUOTAS
|
||||
#define FILE_VOLUME_QUOTAS 0x00000020
|
||||
#endif
|
||||
|
||||
#ifndef FILE_ATTRIBUTE_ARCHIVE
|
||||
#define FILE_ATTRIBUTE_ARCHIVE 0x00000020
|
||||
#endif
|
||||
|
||||
#ifndef FILE_ATTRIBUTE_ENCRYPTED
|
||||
#define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_ATTRIBUTE_HIDDEN
|
||||
#define FILE_ATTRIBUTE_HIDDEN 0x00000002
|
||||
#endif
|
||||
|
||||
#ifndef FILE_ATTRIBUTE_NORMAL
|
||||
#define FILE_ATTRIBUTE_NORMAL 0x00000080
|
||||
#endif
|
||||
|
||||
#ifndef FILE_ATTRIBUTE_OFFLINE
|
||||
#define FILE_ATTRIBUTE_OFFLINE 0x00001000
|
||||
#endif
|
||||
|
||||
#ifndef FILE_ATTRIBUTE_READONLY
|
||||
#define FILE_ATTRIBUTE_READONLY 0x00000001
|
||||
#endif
|
||||
|
||||
#ifndef FILE_ATTRIBUTE_SYSTEM
|
||||
#define FILE_ATTRIBUTE_SYSTEM 0x00000004
|
||||
#endif
|
||||
|
||||
#ifndef FILE_ATTRIBUTE_TEMPORARY
|
||||
#define FILE_ATTRIBUTE_TEMPORARY 0x00000100
|
||||
#endif
|
||||
|
||||
#ifndef FILE_ATTRIBUTE_COMPRESSED
|
||||
#define FILE_ATTRIBUTE_COMPRESSED 0x00000800
|
||||
#endif
|
||||
|
||||
#ifndef FSCTL_SET_COMPRESSION
|
||||
#define FSCTL_SET_COMPRESSION 0x9C040
|
||||
#endif
|
||||
|
||||
#ifndef FILE_RETURNS_CLEANUP_RESULT_INFO
|
||||
#define FILE_RETURNS_CLEANUP_RESULT_INFO 0x00000200
|
||||
#endif
|
||||
|
||||
#ifndef FILE_SUPPORTS_POSIX_UNLINK_RENAME
|
||||
#define FILE_SUPPORTS_POSIX_UNLINK_RENAME 0x00000400
|
||||
#endif
|
||||
|
||||
#ifndef FS_LFN_APIS
|
||||
#define FS_LFN_APIS 0x00004000
|
||||
#endif
|
||||
|
||||
#ifndef COMPRESSION_FORMAT_DEFAULT
|
||||
#define COMPRESSION_FORMAT_DEFAULT 1
|
||||
#endif
|
||||
|
||||
typedef struct _FILE_FULL_EA_INFORMATION
|
||||
{
|
||||
ULONG NextEntryOffset;
|
||||
UCHAR Flags;
|
||||
UCHAR EaNameLength;
|
||||
USHORT EaValueLength;
|
||||
CHAR EaName[1];
|
||||
} FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
|
||||
|
||||
#ifndef FILE_NEED_EA
|
||||
#define FILE_NEED_EA 0x80
|
||||
#endif
|
||||
|
||||
typedef LONG NTSTATUS;
|
||||
|
||||
typedef struct _IO_STATUS_BLOCK
|
||||
{
|
||||
union {
|
||||
NTSTATUS Status;
|
||||
PVOID Pointer;
|
||||
} DUMMYUNIONNAME;
|
||||
PULONG Information;
|
||||
} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
|
||||
|
||||
#ifndef NTAPI
|
||||
#define NTAPI __stdcall
|
||||
#endif
|
||||
|
||||
#ifndef FSCTL_SET_SPARSE
|
||||
#define FSCTL_SET_SPARSE 0x000900C4
|
||||
#endif
|
||||
|
||||
#ifndef FSCTL_SET_ZERO_DATA
|
||||
#define FSCTL_SET_ZERO_DATA 0x000900C8
|
||||
#endif
|
||||
|
||||
#define FSCTL_SET_SPARSE_OLD 0x000980C4
|
||||
#define FSCTL_SET_ZERO_DATA_OLD 0x000980C8
|
||||
|
||||
typedef struct _WINNT_FILE_ZERO_DATA_INFORMATION
|
||||
{
|
||||
LARGE_INTEGER FileOffset;
|
||||
LARGE_INTEGER BeyondFinalZero;
|
||||
} WINNT_FILE_ZERO_DATA_INFORMATION, *PWINNT_FILE_ZERO_DATA_INFORMATION;
|
||||
|
||||
|
||||
typedef struct _WIN_OSVERSIONINFOA
|
||||
{
|
||||
DWORD dwOSVersionInfoSize;
|
||||
|
||||
@@ -205,6 +205,25 @@ unsigned char IconEA[3516] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00};
|
||||
|
||||
typedef struct _IO_STATUS_BLOCK
|
||||
{
|
||||
union
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PVOID Pointer;
|
||||
} DUMMYUNIONNAME;
|
||||
PULONG Information;
|
||||
} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
|
||||
|
||||
typedef struct _FILE_FULL_EA_INFORMATION
|
||||
{
|
||||
ULONG NextEntryOffset;
|
||||
UCHAR Flags;
|
||||
UCHAR EaNameLength;
|
||||
USHORT EaValueLength;
|
||||
CHAR EaName[1];
|
||||
} FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
|
||||
|
||||
static NTSTATUS(NTAPI* NtSetEaFile)(HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG);
|
||||
static NTSTATUS(NTAPI* NtQueryEaFile)(HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG, BOOLEAN, PVOID, ULONG, PULONG, BOOLEAN);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user