Sandboxie/SandboxiePlus/QSbieAPI/Helpers/NtIO.h

39 lines
1.5 KiB
C
Raw Permalink Normal View History

2021-10-16 16:19:51 +01:00
#pragma once
struct SNtObject
{
2022-09-29 17:28:48 +01:00
SNtObject(const std::wstring& Name, HANDLE parent = NULL)
2021-10-16 16:19:51 +01:00
{
name = Name;
RtlInitUnicodeString(&uni, name.c_str());
InitializeObjectAttributes(&attr, &uni, OBJ_CASE_INSENSITIVE, parent, 0);
}
POBJECT_ATTRIBUTES Get() { return &attr; }
2022-09-29 17:28:48 +01:00
std::wstring name;
2021-10-16 16:19:51 +01:00
UNICODE_STRING uni;
OBJECT_ATTRIBUTES attr;
private:
SNtObject(const SNtObject&) {}
SNtObject& operator=(const SNtObject&) { return *this; }
};
2022-02-05 11:42:04 +00:00
bool NtIo_WaitForFolder(POBJECT_ATTRIBUTES objattrs, int seconds = 10, bool (*cb)(const WCHAR* info, void* param) = NULL, void* param = NULL);
2021-10-16 16:19:51 +01:00
2023-07-23 13:46:24 +01:00
BOOLEAN NtIo_FileExists(POBJECT_ATTRIBUTES objattrs);
2021-10-16 16:19:51 +01:00
NTSTATUS NtIo_RemoveProblematicAttributes(POBJECT_ATTRIBUTES objattrs);
NTSTATUS NtIo_RemoveJunction(POBJECT_ATTRIBUTES objattrs);
2023-07-23 13:46:24 +01:00
NTSTATUS NtIo_DeleteFile(SNtObject& ntObject, bool (*cb)(const WCHAR* info, void* param) = NULL, void* param = NULL);
2022-02-05 11:42:04 +00:00
NTSTATUS NtIo_DeleteFolderRecursively(POBJECT_ATTRIBUTES objattrs, bool (*cb)(const WCHAR* info, void* param) = NULL, void* param = NULL);
2021-10-16 16:19:51 +01:00
NTSTATUS NtIo_RenameFile(POBJECT_ATTRIBUTES src_objattrs, POBJECT_ATTRIBUTES dest_objattrs, const WCHAR* DestName);
NTSTATUS NtIo_RenameFolder(POBJECT_ATTRIBUTES src_objattrs, POBJECT_ATTRIBUTES dest_objattrs, const WCHAR* DestName);
NTSTATUS NtIo_RenameJunction(POBJECT_ATTRIBUTES src_objattrs, POBJECT_ATTRIBUTES dest_objattrs, const WCHAR* DestName);
2022-02-05 11:42:04 +00:00
NTSTATUS NtIo_MergeFolder(POBJECT_ATTRIBUTES src_objattrs, POBJECT_ATTRIBUTES dest_objattrs, bool (*cb)(const WCHAR* info, void* param) = NULL, void* param = NULL);