2019-01-27 19:10:00 +00:00
|
|
|
/****************************************************************************
|
2020-03-01 16:56:27 +00:00
|
|
|
Aaru Data Preservation Suite
|
2019-01-27 19:10:00 +00:00
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
Filename : win32.h
|
|
|
|
|
Author(s) : Natalia Portillo
|
|
|
|
|
|
|
|
|
|
--[ Description ] -----------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
Contains 32-bit and 64-bit Windows declarations
|
|
|
|
|
|
|
|
|
|
--[ License ] ---------------------------------------------------------------
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as
|
|
|
|
|
published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
2021-03-09 04:42:30 +00:00
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2019-01-27 19:10:00 +00:00
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------------
|
2020-12-31 23:13:50 +00:00
|
|
|
Copyright (C) 2011-2021 Natalia Portillo
|
2019-01-27 19:10:00 +00:00
|
|
|
*****************************************************************************/
|
|
|
|
|
|
2019-01-27 20:33:59 +00:00
|
|
|
#if defined(__WINDOWS__) || defined(__TOS_WIN__) || defined(__WIN32__) || defined(_WIN64) || defined(_WIN32) || \
|
|
|
|
|
defined(__NT__)
|
2019-01-27 19:10:00 +00:00
|
|
|
|
2020-03-01 16:57:21 +00:00
|
|
|
#ifndef AARU_FSTESTER_SETTER_WIN32_H
|
|
|
|
|
#define AARU_FSTESTER_SETTER_WIN32_H
|
2019-01-27 19:10:00 +00:00
|
|
|
|
2020-04-30 02:12:32 +01:00
|
|
|
#include <windows.h>
|
|
|
|
|
|
2019-01-27 19:10:00 +00:00
|
|
|
#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
|
|
|
|
|
|
2020-05-02 21:32:09 +01:00
|
|
|
#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
|
|
|
|
|
|
2020-05-07 18:20:52 +01:00
|
|
|
#ifndef FS_LFN_APIS
|
|
|
|
|
#define FS_LFN_APIS 0x00004000
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-01-27 19:10:00 +00:00
|
|
|
#ifndef COMPRESSION_FORMAT_DEFAULT
|
|
|
|
|
#define COMPRESSION_FORMAT_DEFAULT 1
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-01-27 20:33:59 +00:00
|
|
|
typedef struct _FILE_FULL_EA_INFORMATION
|
|
|
|
|
{
|
|
|
|
|
ULONG NextEntryOffset;
|
|
|
|
|
UCHAR Flags;
|
|
|
|
|
UCHAR EaNameLength;
|
|
|
|
|
USHORT EaValueLength;
|
|
|
|
|
CHAR EaName[1];
|
2019-01-27 19:10:00 +00:00
|
|
|
} FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
|
|
|
|
|
|
|
|
|
|
#ifndef FILE_NEED_EA
|
|
|
|
|
#define FILE_NEED_EA 0x80
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
typedef LONG NTSTATUS;
|
|
|
|
|
|
2019-01-27 20:33:59 +00:00
|
|
|
typedef struct _IO_STATUS_BLOCK
|
|
|
|
|
{
|
2020-05-07 17:45:44 +01:00
|
|
|
union {
|
2019-01-27 20:33:59 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
|
PVOID Pointer;
|
|
|
|
|
} DUMMYUNIONNAME;
|
|
|
|
|
PULONG Information;
|
2019-01-27 19:10:00 +00:00
|
|
|
} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
|
|
|
|
|
|
2020-05-07 17:45:44 +01:00
|
|
|
#ifndef NTAPI
|
|
|
|
|
#define NTAPI __stdcall
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-01-27 19:10:00 +00:00
|
|
|
#ifndef FSCTL_SET_SPARSE
|
|
|
|
|
#define FSCTL_SET_SPARSE 0x000900C4
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef FSCTL_SET_ZERO_DATA
|
|
|
|
|
#define FSCTL_SET_ZERO_DATA 0x000900C8
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-04-28 22:27:52 +01:00
|
|
|
#define FSCTL_SET_SPARSE_OLD 0x000980C4
|
|
|
|
|
#define FSCTL_SET_ZERO_DATA_OLD 0x000980C8
|
|
|
|
|
|
|
|
|
|
typedef struct _WINNT_FILE_ZERO_DATA_INFORMATION
|
2019-01-27 20:33:59 +00:00
|
|
|
{
|
|
|
|
|
LARGE_INTEGER FileOffset;
|
|
|
|
|
LARGE_INTEGER BeyondFinalZero;
|
2020-04-28 22:27:52 +01:00
|
|
|
} WINNT_FILE_ZERO_DATA_INFORMATION, *PWINNT_FILE_ZERO_DATA_INFORMATION;
|
2019-01-27 19:10:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#define DATETIME_FORMAT "This file is dated %s for %s\r"
|
|
|
|
|
#define MAXDATETIME "60056/05/28 05:36:11"
|
|
|
|
|
#define MINDATETIME "1601/01/01 00:00:00"
|
|
|
|
|
#define Y2KDATETIME "2000/01/01 00:00:00"
|
|
|
|
|
#define Y1KDATETIME "1999/12/31 23:59:59"
|
|
|
|
|
#define MAXTIMESTAMP 0xFFFFFFFF
|
|
|
|
|
#define MINTIMESTAMP 0x00000000
|
|
|
|
|
#define TIMESTAMP_HI 0x01BF53EB
|
|
|
|
|
#define Y2KTIMESTAMP_LO 0x256D4000
|
|
|
|
|
#define Y1KTIMESTAMP_LO 0x24D4A980
|
|
|
|
|
|
2020-05-03 04:49:50 +01:00
|
|
|
typedef struct _WIN_OSVERSIONINFOA
|
|
|
|
|
{
|
|
|
|
|
DWORD dwOSVersionInfoSize;
|
|
|
|
|
DWORD dwMajorVersion;
|
|
|
|
|
DWORD dwMinorVersion;
|
|
|
|
|
DWORD dwBuildNumber;
|
|
|
|
|
DWORD dwPlatformId;
|
|
|
|
|
CHAR szCSDVersion[128]; // Maintenance string for PSS usage
|
|
|
|
|
} WIN_OSVERSIONINFOA, *WIN_POSVERSIONINFOA, *WIN_LPOSVERSIONINFOA;
|
|
|
|
|
|
|
|
|
|
typedef WIN_OSVERSIONINFOA WIN_OSVERSIONINFO;
|
|
|
|
|
typedef WIN_POSVERSIONINFOA WIN_POSVERSIONINFO;
|
|
|
|
|
typedef WIN_LPOSVERSIONINFOA WIN_LPOSVERSIONINFO;
|
|
|
|
|
|
2021-03-11 16:51:04 +00:00
|
|
|
static BOOL(WINAPI* WinGetVersionExA)(WIN_LPOSVERSIONINFOA);
|
2019-01-27 19:10:00 +00:00
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif
|