Sunday, January 11, 2009

Traffic Lights Control System with C++

How to Control the Traffic Lights System in C++. Complete Souce Codes of the Traffic Lithts Control System Very Soon will be uploaded by the Sweety Softs Productions

Monday, January 5, 2009

VB Scripts to manage Registry

Checking Registry Key Access Rights const KEY_QUERY_VALUE = &H0001 const KEY_SET_VALUE = &H0002 const KEY_CREATE_SUB_KEY = &H0004 const DELETE = &H00010000 const HKEY_LOCAL_MACHINE = &H80000002 strComputer = "." Set StdOut = WScript.StdOut Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ strComputer & "\root\default:StdRegProv") strKeyPath = "SYSTEM\CurrentControlSet" oReg.CheckAccess HKEY_LOCAL_MACHINE, strKeyPath, KEY_QUERY_VALUE, _ bHasAccessRight If bHasAccessRight = True Then StdOut.WriteLine "Have Query Value Access Rights on Key" Else StdOut.WriteLine "Do Not Have Query Value Access Rights on Key" End If oReg.CheckAccess HKEY_LOCAL_MACHINE, strKeyPath, KEY_SET_VALUE, _ bHasAccessRight If bHasAccessRight = True Then StdOut.WriteLine "Have Set Value Access Rights on Key" Else StdOut.WriteLine "Do Not Have Set Value Access Rights on Key" End If oReg.CheckAccess HKEY_LOCAL_MACHINE, strKeyPath, KEY_CREATE_SUB_KEY, _ bHasAccessRight If bHasAccessRight = True Then StdOut.WriteLine "Have Create SubKey Access Rights on Key" Else StdOut.WriteLine "Do Not Have Create SubKey Access Rights on Key" End If oReg.CheckAccess HKEY_LOCAL_MACHINE, strKeyPath, DELETE, bHasAccessRight If bHasAccessRight = True Then StdOut.WriteLine "Have Delete Access Rights on Key" Else StdOut.WriteLine "Do Not Have Delete Access Rights on Key" End If ------------------------------------------------------------------------- Creating Expanded String Values: Uses WMI to create an expanded string value under HKLM\SOFTWARE\System Admin Scripting Guide. const HKEY_LOCAL_MACHINE = &H80000002 strComputer = "." Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ strComputer & "\root\default:StdRegProv") strKeyPath = "SOFTWARE\System Admin Scripting Guide" strValueName = "Expanded String Value Name" strValue = "%PATHEXT%" oReg.SetExpandedStringValue _ HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue ------------------------------------------------------------------------------------ Checking Registry Key Access Rights Uses WMI to check access rights for the logged on user to HKLM\SYSTEM\CurrentControlSet. const KEY_QUERY_VALUE = &H0001 const KEY_SET_VALUE = &H0002 const KEY_CREATE_SUB_KEY = &H0004 const DELETE = &H00010000 const HKEY_LOCAL_MACHINE = &H80000002 strComputer = "." Set StdOut = WScript.StdOut Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ strComputer & "\root\default:StdRegProv") strKeyPath = "SYSTEM\CurrentControlSet" oReg.CheckAccess HKEY_LOCAL_MACHINE, strKeyPath, KEY_QUERY_VALUE, _ bHasAccessRight If bHasAccessRight = True Then StdOut.WriteLine "Have Query Value Access Rights on Key" Else StdOut.WriteLine "Do Not Have Query Value Access Rights on Key" End If oReg.CheckAccess HKEY_LOCAL_MACHINE, strKeyPath, KEY_SET_VALUE, _ bHasAccessRight If bHasAccessRight = True Then StdOut.WriteLine "Have Set Value Access Rights on Key" Else StdOut.WriteLine "Do Not Have Set Value Access Rights on Key" End If oReg.CheckAccess HKEY_LOCAL_MACHINE, strKeyPath, KEY_CREATE_SUB_KEY, _ bHasAccessRight If bHasAccessRight = True Then StdOut.WriteLine "Have Create SubKey Access Rights on Key" Else StdOut.WriteLine "Do Not Have Create SubKey Access Rights on Key" End If oReg.CheckAccess HKEY_LOCAL_MACHINE, strKeyPath, DELETE, bHasAccessRight If bHasAccessRight = True Then StdOut.WriteLine "Have Delete Access Rights on Key" Else StdOut.WriteLine "Do Not Have Delete Access Rights on Key" End If ----------------------------------------------------------------------------------------- Creating a Registry Key Uses WMI to create a registry key HKLM\SOFTWARE\System Admin Scripting Guide. const HKEY_LOCAL_MACHINE = &H80000002 strComputer = "." Set StdOut = WScript.StdOut Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ strComputer & "\root\default:StdRegProv") strKeyPath = "SOFTWARE\System Admin Scripting Guide" oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath ---------------------------------------------------------------------------- Creating String and DWORD Values Uses WMI to create string and DWORD values under HKLM\SOFTWARE\System Admin Scripting Guide. const HKEY_LOCAL_MACHINE = &H80000002 strComputer = "." Set StdOut = WScript.StdOut Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ strComputer & "\root\default:StdRegProv") strKeyPath = "SOFTWARE\System Admin Scripting Guide" strValueName = "String Value Name" strValue = "string value" oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue strValueName = "DWORD Value Name" dwValue = 82 oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue -------------------------------------------------------------------------------- Deleting a Registry Key Uses WMI to delete the registry key HKLM\SOFTWARE\System Admin Scripting Guide. const HKEY_LOCAL_MACHINE = &H80000002 strComputer = "." Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ strComputer & "\root\default:StdRegProv") strKeyPath = "SOFTWARE\System Admin Scripting Guide" oReg.DeleteKey HKEY_LOCAL_MACHINE, strKeyPath -------------------------------------------------------------------------- Deleting Registry Values Uses WMI to delete all the registry values under HKLM\SOFTWARE\System Admin Scripting Guide. const HKEY_LOCAL_MACHINE = &H80000002 strComputer = "." Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ strComputer & "\root\default:StdRegProv") strKeyPath = "SOFTWARE\System Admin Scripting Guide" strDWORDValueName = "DWORD Value Name" strExpandedStringValueName = "Expanded String Value Name" strMultiStringValueName = "Multi String Value Name" strStringValueName = "String Value Name" oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strDWORDValueName oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strExpandedStringValueName oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strMultiStringValueName oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strStringValueName ----------------------------------------------------------------------------- Enumerating Registry Properties Returns information about the computer registry. On Error Resume Next strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_Registry") For Each objItem in colItems Wscript.Echo "Current Size: " & objItem.CurrentSize Wscript.Echo "Description: " & objItem.Description Wscript.Echo "Install Date: " & objItem.InstallDate Wscript.Echo "Maximum Size: " & objItem.MaximumSize Wscript.Echo "Name: " & objItem.Name Wscript.Echo "Proposed Size: " & objItem.ProposedSize Next ---------------------------------------------------------------------- Enumerating Registry Values and Types Uses WMI to list all the registry values and their types under HKLM\SYSTEM\CurrentControlSet\Control\Lsa. const HKEY_LOCAL_MACHINE = &H80000002 const REG_SZ = 1 const REG_EXPAND_SZ = 2 const REG_BINARY = 3 const REG_DWORD = 4 const REG_MULTI_SZ = 7 strComputer = "." Set StdOut = WScript.StdOut Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ strComputer & "\root\default:StdRegProv") strKeyPath = "SYSTEM\CurrentControlSet\Control\Lsa" oReg.EnumValues HKEY_LOCAL_MACHINE, strKeyPath,_ arrValueNames, arrValueTypes For i=0 To UBound(arrValueNames) StdOut.WriteLine "Value Name: " & arrValueNames(i) Select Case arrValueTypes(i) Case REG_SZ StdOut.WriteLine "Data Type: String" StdOut.WriteBlankLines(1) Case REG_EXPAND_SZ StdOut.WriteLine "Data Type: Expanded String" StdOut.WriteBlankLines(1) Case REG_BINARY StdOut.WriteLine "Data Type: Binary" StdOut.WriteBlankLines(1) Case REG_DWORD StdOut.WriteLine "Data Type: DWORD" StdOut.WriteBlankLines(1) Case REG_MULTI_SZ StdOut.WriteLine "Data Type: Multi String" StdOut.WriteBlankLines(1) End Select Next --------------------------------------------------------------- Enumerating Subkeys Uses WMI to enumerate all the registry subkeys under HKLM\SYSTEM\CurrentControlSet\Services. const HKEY_LOCAL_MACHINE = &H80000002 strComputer = "." Set StdOut = WScript.StdOut Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ strComputer & "\root\default:StdRegProv") strKeyPath = "SYSTEM\CurrentControlSet\Services" oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys For Each subkey In arrSubKeys StdOut.WriteLine subkey Next --------------------------------------------------------------------- Listing Registry Files Uses WMI to list all the registry file and locations under HKLM\System\CurrentControlSet\Control\Hivelist. const HKEY_LOCAL_MACHINE = &H80000002 strComputer = "." Set StdOut = WScript.StdOut Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ strComputer & "\root\default:StdRegProv") strKeyPath = "System\CurrentControlSet\Control\hivelist" oReg.EnumValues HKEY_LOCAL_MACHINE, strKeyPath,_ arrValueNames, arrValueTypes For i=0 To UBound(arrValueNames) StdOut.WriteLine "File Name: " & arrValueNames(i) & " -- " oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,_ arrValueNames(i),strValue StdOut.WriteLine "Location: " & strValue StdOut.WriteBlankLines(1) Next ------------------------------------------------------------- Monitoring Registry Entry Level Events Temporary event consumer that monitors the registry for any changes to HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CSDVersion. Set wmiServices = GetObject("winmgmts:root/default") Set wmiSink = WScript.CreateObject("WbemScripting.SWbemSink", "SINK_") wmiServices.ExecNotificationQueryAsync wmiSink, _ "SELECT * FROM RegistryValueChangeEvent WHERE Hive='HKEY_LOCAL_MACHINE' " & _ "AND KeyPath='SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion'" _ & " AND ValueName='CSDVersion'" WScript.Echo "Listening for Registry Change Events..." & vbCrLf While(1) WScript.Sleep 1000 Wend Sub SINK_OnObjectReady(wmiObject, wmiAsyncContext) WScript.Echo "Received Registry Change Event" & vbCrLf & _ "------------------------------" & vbCrLf & _ wmiObject.GetObjectText_() End Sub -------------------------------------------------------------------------- Monitoring Registry Subkey Events Temporary event consumer that monitors the registry for any changes to HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion. Set wmiServices = GetObject("winmgmts:root/default") Set wmiSink = WScript.CreateObject("WbemScripting.SWbemSink", "SINK_") wmiServices.ExecNotificationQueryAsync wmiSink, _ "SELECT * FROM RegistryKeyChangeEvent WHERE Hive='HKEY_LOCAL_MACHINE' AND " & _ "KeyPath='SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion'" WScript.Echo "Listening for Registry Change Events..." & vbCrLf While(1) WScript.Sleep 1000 Wend Sub SINK_OnObjectReady(wmiObject, wmiAsyncContext) WScript.Echo "Received Registry Change Event" & vbCrLf & _ "------------------------------" & vbCrLf & _ wmiObject.GetObjectText_() End Sub --------------------------------------------------------------------------- Monitoring Registry Subtree Events Temporary event consumer that monitors the registry for any changes to HKLM. Set wmiServices = GetObject("winmgmts:root/default") Set wmiSink = WScript.CreateObject("WbemScripting.SWbemSink", "SINK_") wmiServices.ExecNotificationQueryAsync wmiSink, _ "SELECT * FROM RegistryTreeChangeEvent WHERE Hive= " _ & "'HKEY_LOCAL_MACHINE' AND RootPath=''" WScript.Echo "Listening for Registry Change Events..." & vbCrLf While(1) WScript.Sleep 1000 Wend Sub SINK_OnObjectReady(wmiObject, wmiAsyncContext) WScript.Echo "Received Registry Change Event" & vbCrLf & _ "------------------------------" & vbCrLf & _ wmiObject.GetObjectText_() End Sub ---------------------------------------------------------------------------- Reading a Binary Registry Value , Uses WMI to read a binary registry value. const HKEY_LOCAL_MACHINE = &H80000002 strComputer = "." Set StdOut = WScript.StdOut Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ strComputer & "\root\default:StdRegProv") strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion" strValueName = "LicenseInfo" oReg.GetBinaryValue HKEY_LOCAL_MACHINE,strKeyPath,_ strValueName,strValue For i = lBound(strValue) to uBound(strValue) StdOut.WriteLine strValue(i) Next ---------------------------------------------------------------------------------- Reading an Expanded String Value Uses WMI to read an expanded string registry value. const HKEY_LOCAL_MACHINE = &H80000002 strComputer = "." Set StdOut = WScript.StdOut Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ strComputer & "\root\default:StdRegProv") strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" strValueName = "UIHost" oReg.GetExpandedStringValue HKEY_LOCAL_MACHINE,strKeyPath,_ strValueName,strValue StdOut.WriteLine "The Windows logon UI host is: " & strValue ---------------------------------------------------------------------------------- Reading a MultiString Value, Uses WMI to read a multi-string registry value. const HKEY_LOCAL_MACHINE = &H80000002 strComputer = "." Set StdOut = WScript.StdOut Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ strComputer & "\root\default:StdRegProv") strKeyPath = "SYSTEM\CurrentControlSet\Services\Eventlog\System" strValueName = "Sources" oReg.GetMultiStringValue HKEY_LOCAL_MACHINE,strKeyPath,_ strValueName,arrValues For Each strValue In arrValues StdOut.WriteLine strValue Next ---------------------------------------------------------------------------------- Reading String and DWORD Values,Uses WMI to read a string and a DWORD registry value. const HKEY_CURRENT_USER = &H80000001 const HKEY_LOCAL_MACHINE = &H80000002 strComputer = "." Set StdOut = WScript.StdOut Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ strComputer & "\root\default:StdRegProv") strKeyPath = "Console" strValueName = "HistoryBufferSize" oReg.GetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue StdOut.WriteLine "Current History Buffer Size: " & dwValue strKeyPath = "SOFTWARE\Microsoft\Windows Script Host\Settings" strValueName = "TrustPolicy" oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue StdOut.WriteLine "Current WSH Trust Policy Value: " & strValue

Driver Updates

Click & Download Driver's Update: http://driveragent.com/?PHPSESSID=5pkp8mljtqid65n1usoadc5v71

Free Download XP-Service Pack III

http://support.microsoft.com/kb/322389

MAC Transformation Pack for XP

Click Here for Downlaod

Using Registry Editor in Real Mode

WARNING: Using Registry Editor incorrectly can cause serious problems that may require you to reinstall Windows 95. Microsoft cannot guarantee that problems resulting from the incorrect use of Registry Editor can be solved. Use Registry Editor at your own risk. NOTE: For information about how to edit the registry, view the Changing Keys And Values online Help topic in Registry Editor (Regedit.exe). Note that you should make a backup copy of the registry files (System.dat and User.dat) before you edit the registry. To export, modify, and then import registry data using Registry. Editor in real mode, follow these steps: Restart your computer. When you see the "Starting Windows 95" message, press the F8 key and then choose Safe Mode Command Prompt Only from the Startup menu. Change to the folder in which Windows 95 is installed by typing the following command at the command prompt, and then press ENTER cd\ where is the folder in which Windows 95 is installed. Make a backup of the registry. To do so, type the following commands at the command prompt, pressing ENTER after each command: attrib -s -h -r *.datcopy user.dat user.savcopy system.dat system.sav For more information about backing up the registry, How to Back Up the Registry To export the registry to a text file, type the following command at the command prompt, and then press ENTER: regedit /e registry.txt This command exports both the System.dat and User.dat files. By default, the Registry.txt file is saved in the folder from which you run Registry Editor. To export a specific registry key to a text file, type the following command at the command prompt, and then press ENTER regedit /e regkey.txt where is the key you want to export. For example, type the following command: regedit /e regkey.txt "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ Microsoft Office\95\Microsoft Network" NOTE: This line is wrapped for readability. This should be typed as one line. Using a text editor (such as Edit.com), modify the Registry.txt file you created in step 4, and then save and close the file. To merge or import the text file back into the registry, type the following command at the command prompt, and then press ENTER: regedit registry.txt [without /c] If you want to create a new registry from the exported text file and replace the existing registry files, type the following command at the command prompt, and then press ENTER: regedit /c registry.txt Creating a new registry file from exported text can be used as a troubleshooting technique to repair a damaged registry. For more information about troubleshooting registry problems in real mode, see the "Using Real-Mode Registry Editor" section of the following article in the Microsoft Knowledge Base: How to Troubleshoot Registry Errors in Windows 95 The changes take effect the next time you start Windows 95. If the changes you make cause problems in Windows 95 or you want to revert to the registry before you made the changes, restart your computer, press the F8 key when you see the "Starting Windows 95" message, and then choose Safe Mode Command Prompt Only from the Startup menu. At the command prompt, type the following commands, pressing ENTER after each command: cd\attrib -s -h -r *.datren user.dat user.badren system.dat system.badcopy user.sav user.datcopy system.sav system.dat NOTE: If user profiles are enabled in Windows 95, the above procedure only changes the User.dat file in the Windows folder. It does not make any changes to the User.dat file in the \profiles\ folder, (where is the name you use to log on to Windows 95. If you want to modify only the System.dat or User.dat file, or if there is a problem working with both the User.dat and System.dat file in one registry file, there are switches you can use that enable you to work with specific files. For information about problems with importing a registry with large keys, see the following article in the Microsoft Knowledge Base: REGEDIT May Not Be Able to Import Registry with Large Keys The following procedure gives the commands for changing step 4 above, which exports the entire registry, and step 6 above, which imports the text file (in this instance, the User.dat file): Step 4: To export the User.dat file to a text file located in the root folder, type the following command at a command prompt, and then press ENTER: regedit /l:c:\windows\user.dat /e c:\user.txt Step 6: To merge or import the User.txt file back into the registry, type the following command: regedit /l:c:\windows\user.dat c:\user.txt [without /c] If you want to create a new User.dat file from the exported text file, thereby replacing the existing User.dat file, type the following command at a command prompt, and then press ENTER: regedit /c registry.txt Syntax loadTOCNode(2, 'moreinformation'); The syntax and command-line switches for using Regedit to import to, create, or export from the registry in real mode are as follows: To merge or import a text file into the registry, use the following command: regedit [/L:system] [/R:user] filename1 To create and replace an existing registry from a text file, use the /c switch as follows: regedit [/L:system] [/R:user] /C filename2 To export text from the registry, use the /e switch as follows: regedit [/L:system] [/R:user] /E filename3 [regpath]