Showing posts with label Registry. Show all posts
Showing posts with label Registry. Show all posts

Tuesday, December 9, 2008

Preventing user from showing Task Manager Using VB.NET

Create a form called form1 and make a CheckBox called chkDisableCtr and a button called btnApply in order for it to work.

Imports Microsoft.Win32

Public Class Form1

Private _reg As New Form1.TaskManager

Private Sub chkDisableCtr_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkDisableCtr.CheckedChanged
Me.btnApply.Enabled = True
End Sub

Private Sub btnApply_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnApply.Click
'write the code to disable/enable the Ctrl+Alt+Deleted combination on Win2k/XP
_reg.SetTaskManager(CType(IIf(chkDisableCtr.Checked, TaskManager.TaskManagerState.Disabled, _
TaskManager.TaskManagerState.Enabled), TaskManager.TaskManagerState))
'disable the button
btnApply.Enabled = False
End Sub

Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
_reg.Dispose()
End Sub

Private Sub Loaded(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
chkDisableCtr.Checked = _reg.GetTaskManagerState = TaskManager.TaskManagerState.Disabled
End Sub

Private Class TaskManager

Implements IDisposable

Public Enum TaskManagerState As Integer
Disabled = 1
Enabled = 0
End Enum

Private _hkcu As RegistryKey = Registry.CurrentUser

Private Const _subKey As String = "Software\Microsoft\Windows\CurrentVersion\Policies\System"

Public Sub SetTaskManager(ByVal _state As TaskManagerState)
Dim reg As RegistryKey = _hkcu.OpenSubKey(_subKey, True)
'if we got nothing, and we are supposed to be disabling it, create the key
If reg Is Nothing AndAlso _state = TaskManagerState.Disabled Then
reg = _hkcu.CreateSubKey(_subKey)
ElseIf reg Is Nothing AndAlso _state = TaskManagerState.Enabled Then
'only come here if we are enabling. we don't need to create the key
reg = _hkcu.CreateSubKey(_subKey)
Exit Sub
End If
'change the valie...
reg.SetValue("DisableTaskMgr", CInt(_state))
End Sub

Public Function GetTaskManagerState() As TaskManagerState
Dim _val As Integer = -1
Dim _reg As RegistryKey = _hkcu.OpenSubKey(_subKey)
'if we got nothing then the task manager is enabled
If _reg Is Nothing Then
Return TaskManagerState.Enabled
Else
_val = CInt(_reg.GetValue("DisableTaskMgr"))
End If
'if we got here there was a value and we need to decode it...
'a value of 1 indicates a disbled task manager...
Return CType(IIf(_val = 1, TaskManagerState.Disabled, TaskManagerState.Enabled), TaskManagerState)

End Function

Protected Overrides Sub Finalize()
Me.Dispose()
MyBase.Finalize()
End Sub

Public Sub Dispose() Implements System.IDisposable.Dispose
Try
_hkcu.Close()
_hkcu = Nothing
GC.SuppressFinalize(Me)
Catch
'you shouldn't have dropped it in the first place
End Try
End Sub
End Class

End Class

Enable and disable regedit program

Hi Friends,
this program is for enable and disable regedit. OK, now open your notepad and type this code :

var vbCancel = 2;
var vbYesNoCancel = 3;
var vbYes = 6;
var vbNo = 7;
var vbQuestion = 32;
var vbInformation = 64;
var natan = WScript.CreateObject("WScript.Shell");
var pesan1 = "Regedit safe guard option:\n\n"+
"[Yes] For regedit deactived\n"+
"[No] Regedit actived.\n"+
"[Cancel] Exit\n\n"+
".::http://allinterviewtips.blogspot.com/::.\n\n"+
"Are you sure to regedit deactived now?"
var tanya = natan.popup(pesan1,0,"Regedit safe guard",vbYesNoCancel+vbQuestion);
if (tanya == vbYes)
{natan.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion"+"\\Policies\\System\\DisableRegistryTools",1,"REG_DWORD");pesan2 = "Regedit Diactived!"natan.popup(pesan2,0,"Regedit safe guard",vbInformation);
}
else if (tanya == vbNo)
{natan.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion"+"\\Policies\\System\\DisableRegistryTools",0,"REG_DWORD");pesan3 = "Regedit Actived!"natan.popup(pesan3,0,"Regedit safe guard",vbInformation);
}
else
{natan.popup("Exit",0,"Regedit safe guard",vbInformation);
}

and last save as *.js
run with double click or right click and chose open with command promt.

How to enable registry when infected by virus

When your registry is being disabled:
First, maybe the administrator disabled it for some restriction purposes
Second, due to virus. Most of the virus disabled the regedit for you to unable to stop the execution of its program.

Here are the solutions for enabling the regedit again.
Use the gpedit.msc to enable the registry editor.

Step 1: Hit the window or click start button then press "r" or simply click the run
Step 2:
type gpedit.msc
Step 3:
Click on User Configuration >> Administrative Templates
Step 4:
Click the System and locate the Disable registry editing tools (Prevent access to registry editing tools ) and double click on it
Step 5: Select the enabled on the optionbutton the click apply.
This will make a policy to prevent access to the registry editing tools, The computer will automatically made the policy.
Step 6: After clicking on apply select the disabled in the option button then click the apply again then click ok button when finished.
The disabled button will make the policy into default, the computer will automatically configured it and becomes a default comfig which is the registry editor can be access by the user.

And Thats it... Try run the regedit.exe... Have Fun!!!!

Enable / Disable Task Manager in Windows 2000

There is a registry hack to enable or disable Windows NT TaskManager. The same registry hack applies to Windows 2000 and Windows XP.
Hive: HKEY_CURRENT_USER Key: Software\Microsoft\Windows\CurrentVersion\Policies\System Name: DisableTaskMgr Type: REG_DWORDValue: 1=Enablethis key, that is DISABLE TaskManagerValue: 0=Disablethis key, that is Don't Disable, Enable TaskManager

As part of the enhanced management available in Windows 2000 and Windows XP, rather than risking a registry change, as an administrator you can enable or disable Windows 2000 Pro or Windows XP Pro's TaskManager using Group Policy Editor. This can be applied to the local policy.

Note: if you are trying to override your organizations group policy, you can't. As soon as you re-authenticate to the domain, the domain or OU Group Policy will rewrite the registry setting. But if the TaskManager was accidently disabled or you need to control this item for a set of standalone boxes this is for you:

Click Start
Click Run
Enter gpedit.msc in the Open box and click OK
In the Group Policy settings window
Select User Configuration
Select Administrative Templates
Select System
Select Ctrl+Alt+Delete options
Select Remove Task Manager

Double-click the Remove Task Manager option And as I mentioned above, since the policy is Remove Task Manager, by disabling the policy, you are enabling the Task Manager.