text
stringlengths
0
1.47k
DECLSPEC_IMPORT DWORD WINAPI KERNEL32$GetLastError(void);
DECLSPEC_IMPORT BOOL WINAPI KERNEL32$FileTimeToSystemTime(const FILETIME *, SYSTEMTIME *);
static int g_auto_select_count = 0;
typedef struct {
int priority_tier;
int auto_select;
long long size_bytes;
long long child_count;
const char *tool;
const char *family;
const char *type;
const char *parser_hint;
wchar_t path[BL_MAX_PATH_LEN];
} bof_triage_target_t;
static bof_triage_target_t g_bof_triage_targets[MAX_BOF_TRIAGE_TARGETS];
static int g_bof_triage_target_count = 0;
static int g_bof_triage_target_overflow = 0;
typedef struct {
const char *tool;
long long size_bytes;
FILETIME last_write_time;
wchar_t path[BL_MAX_PATH_LEN];
} bof_session_candidate_t;
static bof_session_candidate_t g_top_sessions[BOF_TOP_SESSION_COUNT];
static int g_top_session_count = 0;
static int g_session_artifact_counts[BOF_SESSION_TOOL_COUNT];
static int g_session_entries_scanned = 0;
static int g_session_scan_partial = 0;
static int g_session_scan_stop = 0;
static int g_dynamic_entries_scanned = 0;
static int g_dynamic_root_entries_scanned = 0;
static int g_dynamic_scan_partial = 0;
static int g_child_entries_scanned = 0;
static int g_child_scan_partial = 0;
static void inline_memset(void *dest, int value, size_t count) {
unsigned char *d = (unsigned char *)dest;
while (count--) {
*d++ = (unsigned char)value;
}
}
static size_t inline_wcslen(const wchar_t *s) {
size_t i = 0;
if (!s) {
return 0;
}
while (s[i] != L'\0') {
i++;
}
return i;
}
static int build_path(const wchar_t *left, const wchar_t *right, wchar_t *out, size_t out_size) {
size_t idx = 0;
size_t left_idx = 0;
size_t right_idx = 0;
if (!left || !right || !out || out_size == 0) {
return 0;
}
while (left[left_idx] && idx + 1 < out_size) {
out[idx++] = left[left_idx++];
}
while (right[right_idx] && idx + 1 < out_size) {
out[idx++] = right[right_idx++];
}
if (left[left_idx] || right[right_idx]) {
out[0] = L'\0';
return 0;
}
out[idx] = L'\0';
return 1;
}
static int append_wide_in_place(wchar_t *dst, const wchar_t *suffix, size_t out_size) {
size_t idx;
size_t i = 0;
if (!dst || !suffix || out_size == 0) {
return 0;
}
idx = inline_wcslen(dst);
while (suffix[i] && idx + 1 < out_size) {
dst[idx++] = suffix[i++];
}
if (suffix[i]) {
dst[0] = L'\0';
return 0;
}
dst[idx] = L'\0';
return 1;
}
static int is_dot_directory(const wchar_t *name) {
if (!name || name[0] != L'.') {
return 0;