Skip to content

Commit d4e059d

Browse files
committed
fixed warnings
1 parent f0d7c84 commit d4e059d

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

source/yail.cpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ namespace
3030
PVOID dll_base;
3131
PVOID entry_point;
3232
ULONG size_of_image;
33-
UNICODE_STRING full_dll_name;
34-
UNICODE_STRING base_dll_name;
35-
ULONG flags;
36-
USHORT obsolete_load_count;
37-
USHORT tls_index;
33+
[[maybe_unused]] UNICODE_STRING full_dll_name;
34+
[[maybe_unused]] UNICODE_STRING base_dll_name;
35+
[[maybe_unused]] ULONG flags;
36+
[[maybe_unused]] USHORT obsolete_load_count;
37+
[[maybe_unused]] USHORT tls_index;
3838
LIST_ENTRY hash_links;
39-
ULONG time_date_stamp;
39+
[[maybe_unused]] ULONG time_date_stamp;
4040
};
4141
using LdrpHandleTlsDataFn = NTSTATUS(NTAPI*)(LdrDataTableEntryFull*);
4242
using RtlInsertInvertedFunctionTableFn = void(NTAPI*)(PVOID image_base, ULONG size_of_image);
@@ -124,14 +124,12 @@ namespace
124124
}
125125

126126
// --- Handle static TLS ---
127-
auto& tls_directory = nt_headers->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS];
127+
// ReSharper disable once CppUseStructuredBinding
128+
const auto& tls_directory = nt_headers->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS];
128129
if (tls_directory.Size && data->fn_ldrp_handle_tls_data)
129130
{
130131
// Build fake LDR_DATA_TABLE_ENTRY on the stack — zero without memset
131-
LdrDataTableEntryFull entry;
132-
auto* raw = reinterpret_cast<volatile uint8_t*>(&entry);
133-
for (size_t i = 0; i < sizeof(entry); i++)
134-
raw[i] = 0;
132+
LdrDataTableEntryFull entry{};
135133

136134
entry.dll_base = base;
137135
entry.size_of_image = nt_headers->OptionalHeader.SizeOfImage;
@@ -146,7 +144,7 @@ namespace
146144
entry.hash_links.Flink = &entry.hash_links;
147145
entry.hash_links.Blink = &entry.hash_links;
148146

149-
reinterpret_cast<NTSTATUS(NTAPI*)(LdrDataTableEntryFull*)>(data->fn_ldrp_handle_tls_data)(&entry);
147+
(reinterpret_cast<NTSTATUS(NTAPI*)(LdrDataTableEntryFull*)>(data->fn_ldrp_handle_tls_data)(&entry));
150148
}
151149

152150
// --- TLS callbacks ---

0 commit comments

Comments
 (0)