Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidXanatos committed Sep 30, 2018
1 parent 434f5b4 commit 0714037
Show file tree
Hide file tree
Showing 14 changed files with 560 additions and 285 deletions.
14 changes: 11 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,27 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [0.6b] - 2018-09-30

### Fixed
- issues only one instance restriction
- issues with list view separation


## [0.6] - 2018-09-30
### Added
- checkbox to hide the WU settings page instead of automatic operation
- when access elevation fails the tool now asks for admin rights
- added tool entry to setup/remove windows defender update task

### Changed
- ObjectListView.dll is not longer required instead a simple self contained control is used

- replaced the app icon with a nicer one

### Fixed
- issue when UC bypass failed due to restriction to only one instance
- issue when UAC bypass failed due to restriction to only one instance
- then starting a tool from the menu it sets working directory to the tool's directory
- fixed issues with -onclose now no console window is shown and metter "" parsing is implemented
- fixed issues with -onclose now no console window is shown and better "" parsing is implemented


## [0.5] - 2018-09-16
Expand Down
5 changes: 5 additions & 0 deletions wumgr/Common/AppLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ class AppLog
{
private List<string> mLogList = new List<string>();

static public void Line(string str, params object[] args)
{
Line(string.Format(str, args));
}

static public void Line(String line)
{
if (mInstance != null)
Expand Down
120 changes: 60 additions & 60 deletions wumgr/Common/FileOps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,65 +124,65 @@ static public void SetFileAdminSec(String filePath)
File.SetAccessControl(filePath, fs);
}

static string SID_null = "S-1-0-0"; // Null SID
static string SID_Worls = "S-1-1-0"; // World
static string SID_Local = "S-1-2-0"; // Local
static string SID_Console = "S-1-2-1"; // Console Logon
static string SID_OwnerID = "S-1-3-0"; // Creator Owner ID
static string SID_GroupeID = "S-1-3-1"; // Creator Group ID
static string SID_OwnerSvr = "S-1-3-2"; // Creator Owner Server
static string SID_CreatorSvr = "S-1-3-3"; // Creator Group Server
static string SID_OwnerRights = "S-1-3-4"; // Owner Rights
static string SID_NonUnique = "S-1-4"; // Non-unique Authority
static string SID_NTAuth = "S-1-5"; // NT Authority
static string SID_AllServices = "S-1-5-80-0"; // All Services
static string SID_DialUp = "S-1-5-1"; // Dialup
static string SID_LocalAcc = "S-1-5-113"; // Local account
static string SID_LocalAccAdmin = "S-1-5-114"; // Local account and member of Administrators group
static string SID_Net = "S-1-5-2"; // Network
static string SID_Natch = "S-1-5-3"; // Batch
static string SID_Interactive = "S-1-5-4"; // Interactive
//static string SID_ = "S-1-5-5- *X*- *Y* Logon Session
static string SID_Service = "S-1-5-6"; // Service
static string SID_AnonLogin = "S-1-5-7"; // Anonymous Logon

static string SID_Proxy = "S-1-5-8"; // Proxy
static string SID_EDC = "S-1-5-9"; // Enterprise Domain Controllers
static string SID_Self = "S-1-5-10"; // Self
static string SID_AuthenticetedUser = "S-1-5-11"; // Authenticated Users

static string SID_Restricted = "S-1-5-12"; // Restricted Code
static string SID_TermUser = "S-1-5-13"; // Terminal Server User
static string SID_RemoteLogin = "S-1-5-14"; // Remote Interactive Logon
static string SID_ThisORg = "S-1-5-15"; // This Organization
static string SID_IIS = "S-1-5-17"; // IIS_USRS
static string SID_System = "S-1-5-18"; // System(or LocalSystem)

static string SID_NTAuthL = "S-1-5-19"; // NT Authority(LocalService)
static string SID_NetServices = "S-1-5-20"; // Network Service

static string SID_Admins = "S-1-5-32-544"; // Administrators
static string SID_Users = "S-1-5-32-545"; // Users
static string SID_Guests = "S-1-5-32-546"; // Guests
static string SID_PowerUsers = "S-1-5-32-547"; // Power Users
static string SID_AccOps = "S-1-5-32-548"; // Account Operators
static string SID_ServerOps = "S-1-5-32-549"; // Server Operators
static string SID_PrintOps = "S-1-5-32-550"; // Print Operators
static string SID_BackupOps = "S-1-5-32-551"; // Backup Operators
static string SID_Replicators = "S-1-5-32-552"; // Replicators
static string SID_NTLM_Auth = "S-1-5-64-10"; // NTLM Authentication
static string SID_SCh_Auth = "S-1-5-64-14"; // SChannel Authentication
static string SID_DigestAuth = "S-1-5-64-21"; // Digest Authentication
static string SID_NT_Service = "S-1-5-80"; // NT Service
static string SID_All_Services = "S-1-5-80-0"; // All Services
static string SID_VM = "S-1-5-83-0"; // NT VIRTUAL MACHINE\Virtual Machines
static string SID_UntrustedLevel = "S-1-16-0"; // Untrusted Mandatory Level
static string SID_LowLevel = "S-1-16-4096"; // Low Mandatory Level
static string SID_MediumLevel = "S-1-16-8192"; // Medium Mandatory Level
static string SID_MediumPLevel = "S-1-16-8448"; // Medium Plus Mandatory Level
static string SID_HighLevel = "S-1-16-12288"; // High Mandatory Level
static string SID_SysLevel = "S-1-16-16384"; // System Mandatory Level
static string SID_PPLevel = "S-1-16-20480"; // Protected Process Mandatory Level
static string SID_SPLevel = "S-1-16-28672"; // Secure Process Mandatory Level
public static string SID_null = "S-1-0-0"; // Null SID
public static string SID_Worls = "S-1-1-0"; // World
public static string SID_Local = "S-1-2-0"; // Local
public static string SID_Console = "S-1-2-1"; // Console Logon
public static string SID_OwnerID = "S-1-3-0"; // Creator Owner ID
public static string SID_GroupeID = "S-1-3-1"; // Creator Group ID
public static string SID_OwnerSvr = "S-1-3-2"; // Creator Owner Server
public static string SID_CreatorSvr = "S-1-3-3"; // Creator Group Server
public static string SID_OwnerRights = "S-1-3-4"; // Owner Rights
public static string SID_NonUnique = "S-1-4"; // Non-unique Authority
public static string SID_NTAuth = "S-1-5"; // NT Authority
public static string SID_AllServices = "S-1-5-80-0"; // All Services
public static string SID_DialUp = "S-1-5-1"; // Dialup
public static string SID_LocalAcc = "S-1-5-113"; // Local account
public static string SID_LocalAccAdmin = "S-1-5-114"; // Local account and member of Administrators group
public static string SID_Net = "S-1-5-2"; // Network
public static string SID_Natch = "S-1-5-3"; // Batch
public static string SID_Interactive = "S-1-5-4"; // Interactive
//public static string SID_ = "S-1-5-5- *X*- *Y* Logon Session
public static string SID_Service = "S-1-5-6"; // Service
public static string SID_AnonLogin = "S-1-5-7"; // Anonymous Logon

public static string SID_Proxy = "S-1-5-8"; // Proxy
public static string SID_EDC = "S-1-5-9"; // Enterprise Domain Controllers
public static string SID_Self = "S-1-5-10"; // Self
public static string SID_AuthenticetedUser = "S-1-5-11"; // Authenticated Users

public static string SID_Restricted = "S-1-5-12"; // Restricted Code
public static string SID_TermUser = "S-1-5-13"; // Terminal Server User
public static string SID_RemoteLogin = "S-1-5-14"; // Remote Interactive Logon
public static string SID_ThisORg = "S-1-5-15"; // This Organization
public static string SID_IIS = "S-1-5-17"; // IIS_USRS
public static string SID_System = "S-1-5-18"; // System(or LocalSystem)

public static string SID_NTAuthL = "S-1-5-19"; // NT Authority(LocalService)
public static string SID_NetServices = "S-1-5-20"; // Network Service

public static string SID_Admins = "S-1-5-32-544"; // Administrators
public static string SID_Users = "S-1-5-32-545"; // Users
public static string SID_Guests = "S-1-5-32-546"; // Guests
public static string SID_PowerUsers = "S-1-5-32-547"; // Power Users
public static string SID_AccOps = "S-1-5-32-548"; // Account Operators
public static string SID_ServerOps = "S-1-5-32-549"; // Server Operators
public static string SID_PrintOps = "S-1-5-32-550"; // Print Operators
public static string SID_BackupOps = "S-1-5-32-551"; // Backup Operators
public static string SID_Replicators = "S-1-5-32-552"; // Replicators
public static string SID_NTLM_Auth = "S-1-5-64-10"; // NTLM Authentication
public static string SID_SCh_Auth = "S-1-5-64-14"; // SChannel Authentication
public static string SID_DigestAuth = "S-1-5-64-21"; // Digest Authentication
public static string SID_NT_Service = "S-1-5-80"; // NT Service
public static string SID_All_Services = "S-1-5-80-0"; // All Services
public static string SID_VM = "S-1-5-83-0"; // NT VIRTUAL MACHINE\Virtual Machines
public static string SID_UntrustedLevel = "S-1-16-0"; // Untrusted Mandatory Level
public static string SID_LowLevel = "S-1-16-4096"; // Low Mandatory Level
public static string SID_MediumLevel = "S-1-16-8192"; // Medium Mandatory Level
public static string SID_MediumPLevel = "S-1-16-8448"; // Medium Plus Mandatory Level
public static string SID_HighLevel = "S-1-16-12288"; // High Mandatory Level
public static string SID_SysLevel = "S-1-16-16384"; // System Mandatory Level
public static string SID_PPLevel = "S-1-16-20480"; // Protected Process Mandatory Level
public static string SID_SPLevel = "S-1-16-28672"; // Secure Process Mandatory Level

}
6 changes: 3 additions & 3 deletions wumgr/Common/HttpTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,20 +134,20 @@ private void Finish(int Success, int ErrCode, Exception Error = null)
}
catch
{
AppLog.Line(MiscFunc.fmt("Failed to rename download {0}", mDlPath + @"\" + mDlName + ".tmp"));
AppLog.Line("Failed to rename download {0}", mDlPath + @"\" + mDlName + ".tmp");
mDlName += ".tmp";
}

try { File.SetLastWriteTime(mDlPath + @"\" + mDlName, lastTime); } catch { } // set last mod time
}
else if (Success == 2)
{
AppLog.Line(MiscFunc.fmt("File already dowllaoded {0}", mDlPath + @"\" + mDlName));
AppLog.Line("File already dowllaoded {0}", mDlPath + @"\" + mDlName);
}
else
{
try { File.Delete(mDlPath + @"\" + mDlName + ".tmp"); } catch { } // delete partial file
AppLog.Line(MiscFunc.fmt("Failed to download file {0}", mDlPath + @"\" + mDlName));
AppLog.Line("Failed to download file {0}", mDlPath + @"\" + mDlName);
}

Finished?.Invoke(this, new FinishedEventArgs(Success > 0 ? 0 : Canceled ? -1 : ErrCode, Error));
Expand Down
70 changes: 50 additions & 20 deletions wumgr/Common/ListViewExtended.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class ListViewExtended : ListView
/// Windows 95/98/Me: SendMessageW is supported by the Microsoft Layer for Unicode (MSLU). To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems.
/// </returns>
[DllImport("User32.dll"), Description("Sends the specified message to a window or windows. The SendMessage function calls the window procedure for the specified window and does not return until the window procedure has processed the message. To send a message and return immediately, use the SendMessageCallback or SendNotifyMessage function. To post a message to a thread's message queue and return immediately, use the PostMessage or PostThreadMessage function.")]
private static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, LVGROUP lParam);
private static extern IntPtr SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam);

private static int? GetGroupID(ListViewGroup lstvwgrp)
{
Expand All @@ -58,7 +58,7 @@ public class ListViewExtended : ListView
return rtnval;
}

private static void setGrpState(ListViewGroup lstvwgrp, ListViewGroupState state)
public static void setGrpState(ListViewGroup lstvwgrp, ListViewGroupState state)
{
if (Environment.OSVersion.Version.Major < 6) //Only Vista and forward allows collaps of ListViewGroups
return;
Expand All @@ -74,23 +74,39 @@ private static void setGrpState(ListViewGroup lstvwgrp, ListViewGroupState state
group.CbSize = Marshal.SizeOf(group);
group.State = state;
group.Mask = ListViewGroupMask.State;
if (GrpId != null)

IntPtr ip = IntPtr.Zero;
try
{
ip = Marshal.AllocHGlobal(group.CbSize);
if (GrpId != null)
{
group.IGroupId = GrpId.Value;
Marshal.StructureToPtr(group, ip, false);
SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, (IntPtr)GrpId.Value, ip);
SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, (IntPtr)GrpId.Value, ip);
}
else
{
group.IGroupId = gIndex;
Marshal.StructureToPtr(group, ip, false);
SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, (IntPtr)gIndex, ip);
SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, (IntPtr)gIndex, ip);
}
lstvwgrp.ListView.Refresh();
}
catch (Exception ex)
{
group.IGroupId = GrpId.Value;
SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, GrpId.Value, group);
SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, GrpId.Value, group);
System.Diagnostics.Trace.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
}
else
finally
{
group.IGroupId = gIndex;
SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, gIndex, group);
SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, gIndex, group);
if (null != ip) Marshal.FreeHGlobal(ip);
}
lstvwgrp.ListView.Refresh();
}
}

private static void setGrpFooter(ListViewGroup lstvwgrp, string footer)
public static void setGrpFooter(ListViewGroup lstvwgrp, string footer)
{
if (Environment.OSVersion.Version.Major < 6) //Only Vista and forward allows footer on ListViewGroups
return;
Expand All @@ -106,15 +122,29 @@ private static void setGrpFooter(ListViewGroup lstvwgrp, string footer)
group.CbSize = Marshal.SizeOf(group);
group.PszFooter = footer;
group.Mask = ListViewGroupMask.Footer;
if (GrpId != null)

IntPtr ip = IntPtr.Zero;
try
{
ip = Marshal.AllocHGlobal(group.CbSize);
if (GrpId != null)
{
group.IGroupId = GrpId.Value;
SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, (IntPtr)GrpId.Value, ip);
}
else
{
group.IGroupId = gIndex;
SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, (IntPtr)gIndex, ip);
}
}
catch (Exception ex)
{
group.IGroupId = GrpId.Value;
SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, GrpId.Value, group);
System.Diagnostics.Trace.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
}
else
finally
{
group.IGroupId = gIndex;
SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, gIndex, group);
if (null != ip) Marshal.FreeHGlobal(ip);
}
}
}
Expand All @@ -127,7 +157,7 @@ public void SetGroupState(ListViewGroupState state)

public void SetGroupFooter(ListViewGroup lvg, string footerText)
{
setGrpFooter(lvg, footerText);
setGrpFooter(lvg, footerText);
}

protected override void WndProc(ref Message m)
Expand Down Expand Up @@ -177,7 +207,7 @@ protected override void WndProc(ref Message m)
/// The structure may or may not hold errors inside the code, so use at own risk.
/// Reference url: http://msdn.microsoft.com/en-us/library/bb774769(VS.85).aspx
/// </remarks>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode), Description("LVGROUP StructureUsed to set and retrieve groups.")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto), Description("LVGROUP StructureUsed to set and retrieve groups.")]
public struct LVGROUP
{
/// <summary>
Expand Down
Loading

0 comments on commit 0714037

Please sign in to comment.