summaryrefslogtreecommitdiffhomepage
path: root/windows/nsis-plugins/src/driverlogic/driverlogic.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'windows/nsis-plugins/src/driverlogic/driverlogic.cpp')
-rw-r--r--windows/nsis-plugins/src/driverlogic/driverlogic.cpp55
1 files changed, 54 insertions, 1 deletions
diff --git a/windows/nsis-plugins/src/driverlogic/driverlogic.cpp b/windows/nsis-plugins/src/driverlogic/driverlogic.cpp
index 82259c015d..1e1ecc0fc7 100644
--- a/windows/nsis-plugins/src/driverlogic/driverlogic.cpp
+++ b/windows/nsis-plugins/src/driverlogic/driverlogic.cpp
@@ -126,6 +126,7 @@ void __declspec(dllexport) NSISCALL EstablishBaseline
{
pushstring(L"Initialize() function was not called or was not successful");
pushint(EstablishBaselineStatus::GENERAL_ERROR);
+ return;
}
try
@@ -247,7 +248,8 @@ void __declspec(dllexport) NSISCALL IdentifyNewAdapter
if (nullptr == g_context)
{
pushstring(L"Initialize() function was not called or was not successful");
- pushint(EstablishBaselineStatus::GENERAL_ERROR);
+ pushint(IdentifyNewAdapterStatus::GENERAL_ERROR);
+ return;
}
try
@@ -272,6 +274,57 @@ void __declspec(dllexport) NSISCALL IdentifyNewAdapter
}
//
+// RollbackTapAliases
+//
+// Updating the TAP driver may replace GUIDs and aliases.
+// Use this to restore the aliases to their baseline state.
+//
+enum class RollbackTapAliasesStatus
+{
+ GENERAL_ERROR = 0,
+ SUCCESS
+};
+
+void __declspec(dllexport) NSISCALL RollbackTapAliases
+(
+ HWND hwndParent,
+ int string_size,
+ LPTSTR variables,
+ stack_t** stacktop,
+ extra_parameters* extra,
+ ...
+)
+{
+ EXDLL_INIT();
+
+ if (nullptr == g_context)
+ {
+ pushstring(L"Initialize() function was not called or was not successful");
+ pushint(RollbackTapAliasesStatus::GENERAL_ERROR);
+ return;
+ }
+
+ try
+ {
+ g_context->recordCurrentState();
+ g_context->rollbackTapAliases();
+
+ pushstring(L"");
+ pushint(RollbackTapAliasesStatus::SUCCESS);
+ }
+ catch (std::exception & err)
+ {
+ pushstring(common::string::ToWide(err.what()).c_str());
+ pushint(RollbackTapAliasesStatus::GENERAL_ERROR);
+ }
+ catch (...)
+ {
+ pushstring(L"Unspecified error");
+ pushint(RollbackTapAliasesStatus::GENERAL_ERROR);
+ }
+}
+
+//
// Deinitialize
//
// Call this function once during shutdown.