From 3b74322652354becffb0befc95a8cdbcf5c2145a Mon Sep 17 00:00:00 2001 From: Lev Stipakov Date: Tue, 22 Oct 2024 15:18:28 +0300 Subject: [PATCH] gui: add a button to subscribe for notifications Instead of subscribe for notifications at startup, do it on button click. This is because current driver version doesn't yet support notifications. Signed-off-by: Lev Stipakov --- gui/gui.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gui/gui.cpp b/gui/gui.cpp index 1120574..453737e 100644 --- a/gui/gui.cpp +++ b/gui/gui.cpp @@ -15,6 +15,7 @@ #define VER_DEV_NAME L"\\\\.\\ovpn-dco-ver" #define BTN_SEND_CC 100 +#define BTN_SUBSCRIBE_NOTIF 101 LRESULT CALLBACK WindowProcedure(HWND, UINT, WPARAM, LPARAM); @@ -204,8 +205,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR args, int ncmdsho StartOverlappedRead(); - StartOverlappedNotif(); - while (true) { HANDLE events[] = { hEvRead, hEvWrite, hEvNotif }; DWORD waitResult = MsgWaitForMultipleObjects(3, events, FALSE, INFINITE, QS_ALLINPUT); @@ -616,6 +615,8 @@ LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) hCCRemoteAddress = CreateEditBox(hwnd, L"192.168.100.1", 290, 160, 120); hCCRemotePort = CreateEditBox(hwnd, L"1194", 430, 160, 60); + CreatePushButton(hwnd, L"Subscribe notif", (HMENU)BTN_SUBSCRIBE_NOTIF, 640, 160); + CreatePushButton(hwnd, OVPN_IOCTL_MP_NEW_PEER, 10, 210); hMPNewPeerLocalIP = CreateEditBox(hwnd, L"192.168.100.2", 150, 210, 120); hMPNewPeerLocalPort = CreateEditBox(hwnd, L"1194", 290, 210, 60); @@ -686,6 +687,8 @@ LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) } else if ((ULONG)wp == BTN_SEND_CC) { SendCC(); + } else if ((ULONG)wp == BTN_SUBSCRIBE_NOTIF) { + StartOverlappedNotif(); } }