mirror of
https://github.com/amnezia-vpn/win-split-tunnel.git
synced 2026-05-17 08:16:00 +03:00
Improve comments, consistency and API
This commit is contained in:
@@ -190,6 +190,15 @@ Reset
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// It's believed that `InnerDeleteEntry` will never fail as long as
|
||||
// the following conditions are met:
|
||||
//
|
||||
// - The tree's CompareRoutine and FreeRoutine are correctly implemented.
|
||||
// - Nodes in the tree are regarded as internally consistent by tree CompareRoutine.
|
||||
// - `entry` argument is valid.
|
||||
//
|
||||
|
||||
InnerDeleteEntry(Context, entry);
|
||||
}
|
||||
}
|
||||
@@ -301,19 +310,26 @@ FindEntry
|
||||
return (PROCESS_REGISTRY_ENTRY*)RtlLookupElementGenericTableAvl(&Context->Tree, &record);
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
DeleteEntry
|
||||
(
|
||||
CONTEXT *Context,
|
||||
PROCESS_REGISTRY_ENTRY *Entry
|
||||
)
|
||||
{
|
||||
ForEach(Context, ClearDepartingParentLink, Entry->ProcessId);
|
||||
const auto processId = Entry->ProcessId;
|
||||
|
||||
InnerDeleteEntry(Context, Entry);
|
||||
const auto status = InnerDeleteEntry(Context, Entry);
|
||||
|
||||
if (status)
|
||||
{
|
||||
ForEach(Context, ClearDepartingParentLink, processId);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
DeleteEntryById
|
||||
(
|
||||
CONTEXT *Context,
|
||||
@@ -322,10 +338,12 @@ DeleteEntryById
|
||||
{
|
||||
auto entry = FindEntry(Context, ProcessId);
|
||||
|
||||
if (entry != NULL)
|
||||
if (entry == NULL)
|
||||
{
|
||||
DeleteEntry(Context, entry);
|
||||
return false;
|
||||
}
|
||||
|
||||
return DeleteEntry(Context, entry);
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -122,14 +122,14 @@ FindEntry
|
||||
HANDLE ProcessId
|
||||
);
|
||||
|
||||
void
|
||||
bool
|
||||
DeleteEntry
|
||||
(
|
||||
CONTEXT *Context,
|
||||
PROCESS_REGISTRY_ENTRY *Entry
|
||||
);
|
||||
|
||||
void
|
||||
bool
|
||||
DeleteEntryById
|
||||
(
|
||||
CONTEXT *Context,
|
||||
|
||||
@@ -411,7 +411,7 @@ HandleProcessDeparting
|
||||
|
||||
WdfSpinLockAcquire(processRegistry->Lock);
|
||||
|
||||
procregistry::DeleteEntry(processRegistry->Instance, registryEntry);
|
||||
NT_ASSERT(procregistry::DeleteEntry(processRegistry->Instance, registryEntry));
|
||||
|
||||
WdfSpinLockRelease(processRegistry->Lock);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user