WSCPorts Posted August 1, 2005 Share Posted August 1, 2005 (edited) MakeService.Au3 Fixed Alot in a day expandcollapse popup;Service Type Constants Const $KernalDriver = 1 Const $FileSystemDriver = 2 Const $Adapter = 4 Const $RecogizerDriver = 8 Const $OwnProcess = 16 Const $ShareProcess = 32 Const $InteractiveProcess = 255 ;End Service Types ;Error Types Const $Ignore = 0 Const $Normal = 1 Const $Severe = 2 Const $Critical = 3 ;End Error Types ;Startup Mode Strings Const $Boot = "Boot" Const $System = "System" Const $Automatic = "Automatic" Const $Manuel = "Manuel" Const $Disabled = "Disabled" ;End Startup Types ;DestopInteract Boolean If true, the service can ;create or communicate with windows on the desktop. Func ServiceCreate($ServiceName, $DisplayName, $ServicePath, _ $ServiceType, $ErrorControl, $StartMode, $DesktopInteract) Dim $Locator = ObjCreate("WbemScripting.SWbemLocator") Dim $Service = $Locator.ConnectServer() $Service.Security_.ImpersonationLevel = 3 Dim $Process = $Service.Get("Win32_BaseService") $Ret = $Process.Create($ServiceName, _ $DisplayName, _ $ServicePath, _ $ServiceType,_ $ErrorControl, _ $StartMode, _ $DesktopInteract, _ "NT AUTHORITY\LocalService", "") $Ret.StartService() If $Ret = @Error then exit EndIF EndFunc Au3Service.au3 #include <MakeService.au3> Dim $Au3 = ServiceCreate("Au3Service", "Au3Service", "C:\*\Autoit3\autoit3.exe", $OwnProcess, $Normal, $Manuel, True ) Edited August 3, 2005 by WSCPorts http://www.myclanhosting.com/defiasVisit Join and contribute to a soon to be leader in Custumized tools development in [C# .Net 1.1 ~ 2.0/C/C++/MFC/AutoIt3/Masm32] Link to comment Share on other sites More sharing options...
layer Posted August 1, 2005 Share Posted August 1, 2005 (edited) Several things wrong... Just didn't list em... And I don't see a service in the task manager ? Func _ServiceCreate($ServiceName, $ServicePath) Const $impersonation = 3 Const $OWN_PROCESS = 16 Const $NOT_INTERACTIVE = False Const $NORMAL_ERROR_CONTROL = 1 Dim $Locator = ObjCreate ("WbemScripting.SWbemLocator") Dim $Service = $Locator.ConnectServer () $Service.Security_.ImpersonationLevel = $impersonation Dim $Process = $Service.Get ("Win32_BaseService") $Ret = $Process.Create ($ServiceName, _ "New Service", _ $ServicePath, _ $OWN_PROCESS, _ $NORMAL_ERROR_CONTROL, _ "Manual", _ $NOT_INTERACTIVE, _ "NT AUTHORITY\LocalService", "") If $Ret = @error Then Exit EndIf EndFunc ;==>_ServiceCreate I also changed the name just for consistency even though I don't think it works. Edited August 1, 2005 by layer FootbaG Link to comment Share on other sites More sharing options...
WSCPorts Posted August 1, 2005 Author Share Posted August 1, 2005 (edited) if that dont work this will expandcollapse popup#include <Array.au3> ;CreateFlags Const $Debug_Process = 1 Const $Debug_Only_This_Process = 2 Const $Create_Suspended = 4 Const $Detached_Process = 8 Const $Create_New_Console = 16 Const $Create_New_Process_Group = 512 Const $Create_Unicode_Environment = 1024 Const $Create_Default_Error_Mode = 67108864 Const $CREATE_BREAKAWAY_FROM_JOB = 16777216 ;End CreateFlags ;Environment Variables ;List settings for the configuration of a computer. Environment variables ;specify search paths for files, directories for temporary files, ;application-specific options, and other similar information. The system maintains ;a block of environment settings for each user and one for the computer. The ;system environment block represents environment variables for all users of a ;specific computer. A user's environment block represents the environment ;variables that the system maintains for a specific user, and includes the set of ;system environment variables. By default, each process receives a copy of the ;environment block for its parent process. Typically, this is the environment block ;for the user who is logged on. A process can specify different environment blocks ;for its child processes. ;EndEnvVars Blurb taken from ;http://msdn.microsoft.com/library/default.asp?url=/library/en-;us/wmisdk/wmi/create_method_in_class_win32_process.asp ;ErrorMode types Const $Fail_Critical_Errors = 1 Const $No_Alignment_Fault_Except = 2 Const $No_GP_Fault_Error_Box = 4 Const $No_Open_File_Error_Box = 8 ;end ErrorMode Types ;Console Windows IE cmd.exe NOT Gui Fillattributes Const $Foreground_Blue = 1 Const $Foreground_Green = 2 Const $Foreground_Red = 4 Const $Foreground_Intensity = 8 Const $Background_Blue = 16 Const $Background_Green = 32 Const $Background_Red = 64 Const $BackGround_Intensity = 128 ;EndFillAttributes ;PriorityClass Types Const $Normal = 32 Const $Idle = 64 Const $High = 128 Const $Realtime = 256 Const $Above_Normal = 16384 Const Below_Normal = 32768 ;End PriorityClass Types ;ShowWindow Types = Gui Constants The sw_all's Const $Null = chr(0) Const $impersonation = 3 ;Get Locator Object Dim $Locator = ObjCreate("WbemScripting.SWbemLocator") ;Get SwbemServices Object Dim $Service = $Locator.ConnectServer() ;Set Impersonation level $Service.Security_.ImpersonationLevel = $impersonation ;Get Process Startup Context Object Dim $objStartup = $Service.Get("Win32_ProcessStartup") ;Make a instance to Configure Dim $objConfig = eval("$objStartup.SpawnInstance_()") Func _ProcessStartUp($CreateFlags, $EnvVars, $ErrorMode, _ $FillAttribute, $ShowWindow, $Title) If Not IsArray($objConfigured[6]) then Dim $objConfigured[6] $objConfig.CreateFlags = $CreateFlags $objConfigured[1] = $CreateFlags $objConfig.EnvironmentVariables = $EnvVars $objConfigured[2] = $EnvVars $objConfig.ErrorMode = $ErrorMode $objConfigured[3] = $ErrorMode $objCondif.FillAttribute = $FillAttribute $objConfigured[4] = $FillAttribute $objConfig.ShowWindow = $ShowWindow $objConfigured[5] = $ShowWindow $objConfig.Title = $Title $objConfigured[6] = $Title Return $objConfig EndIf EndFunc Func _ProcessCreate($strPathProc) ;Get a Propcess Object Dim $Process = $Service.Get("Win32_Process") if Not @Error then ;Create our process with the Create Method of the Process Object $Process.Create($strPathProc, $Null, $objConfig, $intProcessID) else Exit EndFunc Edited August 2, 2005 by WSCPorts http://www.myclanhosting.com/defiasVisit Join and contribute to a soon to be leader in Custumized tools development in [C# .Net 1.1 ~ 2.0/C/C++/MFC/AutoIt3/Masm32] Link to comment Share on other sites More sharing options...
WSCPorts Posted August 2, 2005 Author Share Posted August 2, 2005 any Comments? Critisism anything Help me if u see more errors or know of a better way for me to code as im used to Perl and james warringtons style of vbs.. im trying to master Conversion of said Languages its hard.... http://www.myclanhosting.com/defiasVisit Join and contribute to a soon to be leader in Custumized tools development in [C# .Net 1.1 ~ 2.0/C/C++/MFC/AutoIt3/Masm32] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now