1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2026-01-10 04:23:22 +00:00

Merge branch 'master' of https://github.com/Ylianst/MeshAgent into master

This commit is contained in:
Bryan Roe
2021-07-14 09:42:05 -07:00
9 changed files with 57 additions and 34 deletions

Binary file not shown.

View File

@@ -100,7 +100,7 @@ END
IDD_INSTALLDIALOG DIALOGEX 0, 100, 317, 148
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION
CAPTION "Mesh Agent v2"
CAPTION "MeshCentral Agent"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
PUSHBUTTON "Close",IDCANCEL,260,127,50,14
@@ -109,17 +109,17 @@ BEGIN
PUSHBUTTON "Install / Update",IDC_INSTALLBUTTON,7,127,65,14
PUSHBUTTON "Uninstall",IDC_UNINSTALLBUTTON,75,127,65,14
ICON IDI_ICON1,IDC_STATIC,288,7,20,20
LTEXT "Current Agent Status",IDC_AGENTSTATUS_TEXT,14,51,70,8
LTEXT "Current Agent Status",IDC_AGENTSTATUS_TEXT,14,51,100,8
LTEXT "Unknown",IDC_STATUSTEXT,127,51,175,8,0,WS_EX_RIGHT
LTEXT "New Agent Version",IDC_AGENT_VERSION,14,63,62,8
LTEXT "New Agent Version",IDC_AGENT_VERSION,14,63, 100,8
LTEXT "Unknown",IDC_VERSIONTEXT,127,63,175,8,0,WS_EX_RIGHT
LTEXT "New Mesh Identifier",IDC_MESH_IDENTIFIER,14,99,65,8
LTEXT "New Group Id",IDC_MESH_IDENTIFIER,14,99, 100,8
LTEXT "Unknown",IDC_HASHTEXT,127,99,175,8,0,WS_EX_RIGHT
LTEXT "New Mesh Name",IDC_MESH_NAME,14,87,54,8
LTEXT "New Group Name",IDC_MESH_NAME,14,87, 100,8
LTEXT "Unknown",IDC_POLICYTEXT,127,87,175,8,0,WS_EX_RIGHT
LTEXT "New Server Identifier",IDC_SERVER_IDENTIFIER,14,111,70,8
LTEXT "New Server Identifier",IDC_SERVER_IDENTIFIER,14,111, 100,8
LTEXT "Unknown",IDC_SERVERID,127,111,175,8,0,WS_EX_RIGHT
LTEXT "New Server Location",IDC_SERVER_LOCATION,14,75,67,8
LTEXT "New Server Location",IDC_SERVER_LOCATION,14,75, 100,8
LTEXT "Unknown",IDC_SERVERLOCATION,127,75,175,8,0,WS_EX_RIGHT
PUSHBUTTON "Connect",IDC_CONNECTBUTTON,143,127,65,14
END

View File

@@ -881,6 +881,8 @@ INT_PTR CALLBACK DialogHandler(HWND hDlg, UINT message, WPARAM wParam, LPARAM lP
{
char *fileName = NULL, *meshname = NULL, *meshid = NULL, *serverid = NULL, *serverurl = NULL, *installFlags = NULL, *mshfile = NULL;
char *displayName = NULL, *meshServiceName = NULL;
int hiddenButtons = 0; // Flags: 1 if "Connect" is hidden, 2 if "Uninstall" is hidden, 4 is "Install is hidden"
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
@@ -1084,17 +1086,20 @@ INT_PTR CALLBACK DialogHandler(HWND hDlg, UINT message, WPARAM wParam, LPARAM lP
if (meshid == NULL) { EnableWindow(GetDlgItem(hDlg, IDC_CONNECTBUTTON), FALSE); }
if ((installFlagsInt & 3) == 1) {
// Temporary Agent Only
hiddenButtons |= 6; // Both install and uninstall buttons are hidden
ShowWindow(GetDlgItem(hDlg, IDC_INSTALLBUTTON), SW_HIDE);
ShowWindow(GetDlgItem(hDlg, IDC_UNINSTALLBUTTON), SW_HIDE);
GetWindowPlacement(GetDlgItem(hDlg, IDC_INSTALLBUTTON), &lpwndpl);
SetWindowPlacement(GetDlgItem(hDlg, IDC_CONNECTBUTTON), &lpwndpl);
} else if ((installFlagsInt & 3) == 2) {
// Background Only
hiddenButtons |= 1; // Connect button is hidden hidden
ShowWindow(GetDlgItem(hDlg, IDC_CONNECTBUTTON), SW_HIDE);
} else if ((installFlagsInt & 3) == 3) {
// Uninstall only
GetWindowPlacement(GetDlgItem(hDlg, IDC_INSTALLBUTTON), &lpwndpl);
SetWindowPlacement(GetDlgItem(hDlg, IDC_UNINSTALLBUTTON), &lpwndpl);
hiddenButtons |= 5; // Both install and connect buttons are hidden
ShowWindow(GetDlgItem(hDlg, IDC_INSTALLBUTTON), SW_HIDE);
ShowWindow(GetDlgItem(hDlg, IDC_CONNECTBUTTON), SW_HIDE);
}
@@ -1104,7 +1109,6 @@ INT_PTR CALLBACK DialogHandler(HWND hDlg, UINT message, WPARAM wParam, LPARAM lP
EnableWindow(GetDlgItem(hDlg, IDC_CONNECTBUTTON), FALSE);
}
// Get the current service running state
int r = GetServiceState(meshServiceName != NULL ? meshServiceName : serviceFile);
SetWindowTextW(GetDlgItem(hDlg, IDC_INSTALLBUTTON), update_buttontext);
@@ -1117,14 +1121,25 @@ INT_PTR CALLBACK DialogHandler(HWND hDlg, UINT message, WPARAM wParam, LPARAM lP
case 0:
case 100: // Not installed
SetWindowTextW(GetDlgItem(hDlg, IDC_STATUSTEXT), state_notinstalled);
ShowWindow(GetDlgItem(hDlg, IDC_UNINSTALLBUTTON), SW_HIDE);
SetWindowTextW(GetDlgItem(hDlg, IDC_INSTALLBUTTON), install_buttontext);
hiddenButtons |= 2; // Uninstall buttons is hidden
ShowWindow(GetDlgItem(hDlg, IDC_UNINSTALLBUTTON), SW_HIDE);
break;
default: // Not running
SetWindowTextW(GetDlgItem(hDlg, IDC_STATUSTEXT), state_notrunning);
break;
}
// Correct the placement of buttons, push them to the left side if some of them are hidden.
if (hiddenButtons == 2) { // Uninstall button is the only one hidden. Place connect button at uninstall position
WINDOWPLACEMENT lpwndpl;
GetWindowPlacement(GetDlgItem(hDlg, IDC_UNINSTALLBUTTON), &lpwndpl);
SetWindowPlacement(GetDlgItem(hDlg, IDC_CONNECTBUTTON), &lpwndpl);
} else if (hiddenButtons == 6) { // Only connect button is showing, place it in the install button location
WINDOWPLACEMENT lpwndpl;
GetWindowPlacement(GetDlgItem(hDlg, IDC_INSTALLBUTTON), &lpwndpl);
SetWindowPlacement(GetDlgItem(hDlg, IDC_CONNECTBUTTON), &lpwndpl);
}
if (mshfile != NULL) { free(mshfile); }
Duktape_SafeDestroyHeap(ctx);

View File

@@ -1,3 +1,3 @@
// This file is auto-generated, any edits may be overwritten
#define SOURCE_COMMIT_DATE "2020-Oct-13 18:14:15-0700"
#define SOURCE_COMMIT_HASH "78b65edc4e326bc239cf3fbac6b769bc207057ba"
// This file is auto-generated, any edits may be overwritten
#define SOURCE_COMMIT_DATE "2021-Jul-11 11:42:24-0700"
#define SOURCE_COMMIT_HASH "5618516cb96f22a24ae06fc910a61cfeb2d9eaa9"

View File

@@ -3991,6 +3991,7 @@ ILibTransport_DoneState ILibDuktape_httpStream_webSocket_WriteWebSocketPacket(IL
size_t compressedLen = 0;
char *compressedBuffer = NULL;
if (!ILibMemory_CanaryOK(state)) { return(ILibTransport_DoneState_ERROR); }
buffer = _buffer;
bufferLen = _bufferLen;

File diff suppressed because one or more lines are too long

View File

@@ -10925,6 +10925,7 @@ int ILibIsRunningOnChainThread(void* chain)
{
if (chain == NULL) { return(1); }
struct ILibBaseChain* c = (struct ILibBaseChain*)chain;
#if defined(WIN32)
return(c->ChainThreadID == 0 || c->ChainThreadID == GetCurrentThreadId());
#else

View File

@@ -4083,9 +4083,9 @@ void* ILibSCTP_AddPacketToHoldingQueue(struct ILibStun_dTlsSession* o, ILibSCTP_
{
void* retVal = NULL;
// Out of sequence packet, find a spot in the receive queue.
RCTPRCVDEBUG(printf("STORING %u, size = %d\r\n", tsn, chunksize);)
if (ReceiveHoldBuffer_Used(o->receiveHoldBuffer) + payload->length > ILibSCTP_MaxReceiverCredits) { *sentsack = ILibSCTP_SackStatus_Skip; return(NULL); }
RCTPRCVDEBUG(printf("STORING %u, size = %d\r\n", ntohl(payload->TSN), ntohs(payload->length));)
if (ReceiveHoldBuffer_Used(o->receiveHoldBuffer) + payload->length > ILibSCTP_MaxReceiverCredits) { *sentsack = ILibSCTP_SackStatus_Skip; return(NULL); }
retVal = ILibLinkedList_SortedInsertEx(o->receiveHoldBuffer, &ILibSCTP_AddPacketToHoldingQueue_Comparer, &ILibSCTP_AddPacketToHoldingQueue_Chooser, payload, o->receiveHoldBuffer);

View File

@@ -124,31 +124,37 @@ function windows_notifybar_local(title)
{
case 4:
flags = msg.lparam_raw.Deref(24, 4).toBuffer().readUInt32LE() | 0x0002; // Set SWP_NOMOVE
if (msg.lparam_raw.Deref(8, 4).toBuffer().readInt32LE() < this._options.window.left ||
(msg.lparam_raw.Deref(8, 4).toBuffer().readInt32LE() + this._options.window.width) >= this._options.window.right)
{
// Disallow this move, because it will go out of bounds of the current monitor
msg.lparam_raw.Deref(24, 4).toBuffer().writeUInt32LE(flags);
// If the bar is too far left, adjust to left most position
if (msg.lparam_raw.Deref(8, 4).toBuffer().readInt32LE() < this._options.window.left) {
msg.lparam_raw.Deref(8, 4).toBuffer().writeInt32LE(this._options.window.left);
}
else
{
// Allow the move, but only on the X-axis
msg.lparam_raw.Deref(12, 4).toBuffer().writeInt32LE(this._options.window.y);
// If the bar is too far right, adjust to right most position
if ((msg.lparam_raw.Deref(8, 4).toBuffer().readInt32LE() + this._options.window.width) >= this._options.window.right) {
msg.lparam_raw.Deref(8, 4).toBuffer().writeInt32LE(this._options.window.right - this._options.window.width);
}
// Lock the bar to the y axis
msg.lparam_raw.Deref(12, 4).toBuffer().writeInt32LE(this._options.window.y);
break;
case 8:
flags = msg.lparam_raw.Deref(32, 4).toBuffer().readUInt32LE() | 0x0002 // Set SWP_NOMOVE
if (msg.lparam_raw.Deref(16, 4).toBuffer().readInt32LE() < this._options.window.left ||
(msg.lparam_raw.Deref(16, 4).toBuffer().readInt32LE() + this._options.window.width) >= this._options.window.right)
{
// Disallow this move, because it will go out of bounds of the current monitor
msg.lparam_raw.Deref(32, 4).toBuffer().writeUInt32LE(flags);
// If the bar is too far left, adjust to left most position
if (msg.lparam_raw.Deref(16, 4).toBuffer().readInt32LE() < this._options.window.left) {
msg.lparam_raw.Deref(16, 4).toBuffer().writeInt32LE(this._options.window.left);
}
else
{
// Allow the move, but only on the X-axis
msg.lparam_raw.Deref(20, 4).toBuffer().writeInt32LE(this._options.window.y);
// If the bar is too far right, adjust to right most position
if ((msg.lparam_raw.Deref(32, 4).toBuffer().readInt32LE() + this._options.window.width) >= this._options.window.right) {
msg.lparam_raw.Deref(32, 4).toBuffer().writeInt32LE(this._options.window.right - this._options.window.width);
}
// Lock the bar to the y axis
msg.lparam_raw.Deref(20, 4).toBuffer().writeInt32LE(this._options.window.y);
break;
}
}