mirror of
https://github.com/tnodir/fort
synced 2024-11-15 06:55:54 +00:00
Driver: fortprov: Minor refactor
This commit is contained in:
parent
f90885afef
commit
f0877ccfe0
@ -347,42 +347,31 @@ FORT_API void fort_prov_init()
|
||||
fort_prov_init_reauth_filters();
|
||||
}
|
||||
|
||||
FORT_API DWORD fort_prov_trans_close(HANDLE engine, DWORD status)
|
||||
FORT_API DWORD fort_prov_trans_open(HANDLE *engine)
|
||||
{
|
||||
if (NT_SUCCESS(status)) {
|
||||
status = fort_prov_trans_commit(engine);
|
||||
} else {
|
||||
fort_prov_trans_abort(engine);
|
||||
}
|
||||
DWORD status = fort_prov_open(engine);
|
||||
|
||||
fort_prov_close(engine);
|
||||
if (status == 0) {
|
||||
status = fort_prov_trans_begin(*engine);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static DWORD fort_prov_trans_open_engine(HANDLE transEngine, HANDLE *engine)
|
||||
{
|
||||
DWORD status = 0;
|
||||
|
||||
if (transEngine) {
|
||||
*engine = transEngine;
|
||||
} else {
|
||||
status = fort_prov_open(engine);
|
||||
|
||||
if (status == 0) {
|
||||
status = fort_prov_trans_begin(*engine);
|
||||
if (status != 0) {
|
||||
fort_prov_close(*engine);
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static DWORD fort_prov_trans_close_engine(HANDLE transEngine, HANDLE engine, DWORD status)
|
||||
FORT_API DWORD fort_prov_trans_close(HANDLE engine, DWORD status)
|
||||
{
|
||||
if (!transEngine) {
|
||||
status = fort_prov_trans_close(engine, status);
|
||||
if (status == 0) {
|
||||
status = fort_prov_trans_commit(engine);
|
||||
} else {
|
||||
fort_prov_trans_abort(engine);
|
||||
}
|
||||
|
||||
fort_prov_close(engine);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -481,16 +470,21 @@ FORT_API void fort_prov_flow_unregister(HANDLE engine)
|
||||
FwpmFilterDeleteByKey0(engine, (GUID *) &FORT_GUID_FILTER_OUT_TRANSPORT_V6);
|
||||
}
|
||||
|
||||
FORT_API void fort_prov_unregister(HANDLE transEngine)
|
||||
FORT_API void fort_prov_unregister(HANDLE engine)
|
||||
{
|
||||
HANDLE engine;
|
||||
if (fort_prov_trans_open_engine(transEngine, &engine))
|
||||
return;
|
||||
|
||||
fort_prov_flow_unregister(engine);
|
||||
fort_prov_unregister_provider(engine);
|
||||
}
|
||||
|
||||
fort_prov_trans_close_engine(transEngine, engine, /*status=*/0);
|
||||
FORT_API void fort_prov_trans_unregister(void)
|
||||
{
|
||||
HANDLE engine;
|
||||
if (NT_SUCCESS(fort_prov_trans_open(&engine))) {
|
||||
|
||||
fort_prov_unregister(engine);
|
||||
|
||||
fort_prov_trans_close(engine, /*status=*/0);
|
||||
}
|
||||
}
|
||||
|
||||
static DWORD fort_prov_register_filters(HANDLE engine, const FORT_PROV_BOOT_CONF boot_conf)
|
||||
@ -580,7 +574,7 @@ FORT_API DWORD fort_prov_reauth(HANDLE engine)
|
||||
DWORD status;
|
||||
|
||||
status = fort_prov_unregister_reauth_filters(engine, /*force=*/FALSE);
|
||||
if (status) {
|
||||
if (status != 0) {
|
||||
status = fort_prov_add_filters(
|
||||
engine, g_provGlobal.reauth_filters, FORT_PROV_REAUTH_FILTERS_COUNT);
|
||||
}
|
||||
|
@ -28,11 +28,15 @@ extern "C" {
|
||||
|
||||
FORT_API void fort_prov_init(void);
|
||||
|
||||
FORT_API DWORD fort_prov_trans_close(HANDLE transEngine, DWORD status);
|
||||
FORT_API DWORD fort_prov_trans_open(HANDLE *engine);
|
||||
|
||||
FORT_API DWORD fort_prov_trans_close(HANDLE engine, DWORD status);
|
||||
|
||||
FORT_API void fort_prov_flow_unregister(HANDLE engine);
|
||||
|
||||
FORT_API void fort_prov_unregister(HANDLE transEngine);
|
||||
FORT_API void fort_prov_unregister(HANDLE engine);
|
||||
|
||||
FORT_API void fort_prov_trans_unregister(void);
|
||||
|
||||
FORT_API DWORD fort_prov_register(HANDLE engine, const FORT_PROV_BOOT_CONF boot_conf);
|
||||
|
||||
|
@ -326,14 +326,12 @@ static NTSTATUS fort_device_register_provider(void)
|
||||
{
|
||||
NTSTATUS status;
|
||||
|
||||
HANDLE engine;
|
||||
status = fort_prov_open(&engine);
|
||||
if (!NT_SUCCESS(status))
|
||||
return status;
|
||||
|
||||
fort_prov_init();
|
||||
|
||||
fort_prov_trans_begin(engine);
|
||||
HANDLE engine;
|
||||
status = fort_prov_trans_open(&engine);
|
||||
if (!NT_SUCCESS(status))
|
||||
return status;
|
||||
|
||||
const FORT_PROV_BOOT_CONF boot_conf = fort_prov_get_boot_conf(engine);
|
||||
|
||||
@ -427,6 +425,6 @@ FORT_API void fort_device_unload(void)
|
||||
|
||||
/* Unregister filters provider */
|
||||
if (fort_device_flag(&fort_device()->conf, FORT_DEVICE_BOOT_FILTER) == 0) {
|
||||
fort_prov_unregister(NULL);
|
||||
fort_prov_trans_unregister();
|
||||
}
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ int bitScanForward(quint32 mask)
|
||||
|
||||
void provUnregister()
|
||||
{
|
||||
fort_prov_unregister(nullptr);
|
||||
fort_prov_trans_unregister();
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user