Windows File System Related Tips

Optimize File Allocation Size
If you work with very large files or disk intensive applications you may be able to speed up operations by changing the contiguous file allocation size. After making the change, defrag your drive. On 9x PCs edit HKLM\System\CurrentControlSet\Control\FileSystem and change ContigFileAllocSize (DWord) to 512. On NT/2K/XP PCs the value is under HKLM\System\CurrentControlSet\Control\Session Manager\Memory Management.

Increase NTFS Performance
Drop the last accessed date/time stamp from files so NTFS doesn't have to update them and drop the DOS 8.3 file name by setting the following DWord values to 1. The values are NtfsDisableLastAccessUpdate and NtfsDisable8Dot3NameCreation under HKLM\System\CurrentControlSet\Control\FileSystem.

Determine if an Exe or DLL is 16 or 32-bit
To see if an executable or DLL is a 16 or 32-bit file, right click it and select Quick View. Find the Signature entry. A value of 454E indicates 16-bit while 4550 denotes a 32-bit file. These values represent "NE" and "PE" respectively.

Turn off Windows XP's Built-In Support for Zip Files
To use WinZip instead of XP's built in zip file support, Click Start | Run and type in regsvr32 /u %windir%\system32\zipfldr.dll then click OK and restart Windows.

To restore XP's built in Zip file support, Click Start | Run and type in regsvr32 %windir%\system32\zipfldr.dll then click OK and restart Windows.

Determining if an Exe or DLL is Self Registering
Right click it, select Properties, Version. Look for the OLESelfRegister entry.

4K File Alignment - Win98
Executables and DLLs should be aligned on 4K boundaries under Windows 98 to speed up their load time. To check a file’s alignment, right click it and select Quick View. Look at the File Alignment value. A 200 (hex for 512) indicates it is not. A 1000 value (4K in hex) says that it is.

Clearing the Open With Dialog's Always Use Checkbox
Double clicking an unknown file type displays the Open With dialog. It is easy to forget to clear the Always Use box if you don't want the association to be permanent. The clear this box forever, open HKCR\Unknown\shell\OpenAs\command. Double click the Default entry and add %2 right after the %1.

Exclude Apps From Window's Defragmenter - Win9x
Disk Defragmenter in Windows 9X actually fragments applications to make them load faster. Taskmon, which runs in the background, stores data on your applications in .LGC files in the Windows\Applog folder. Disk Defragmenter examines these files to know how to optimize your hard drive then writes its own information to the Optlog.txt file. The problem is, if you use an application regularly Disk Defragmenter will store part or all of that file optimally on your disk. Now if you no longer use that application, it will occupy prime locations on your hard drive until the defragmenter builds up enough history on your other apps. To prevent an application from being optimized, delete its .LGC file before defragging. You can also add its name to the HKLM\Software\Microsoft\ Windows\CurrentVersion\TaskMon\ExcludeApps registry key.

Remove Control Panel Applets
To prevent control panel applets from loading and being displayed, open Control.Ini with Notepad. Find the section [Don't Load] or create it if it doesn't exists. Under that section, add the line xxx.cpl=yes where xxx is the name of the applet you do not want to load. Changes will takes effect the next time you reboot.

Customize the Open Dialog Place Bar - Office 2000
The left side of the Office2K Open Dialog displays 5 icons for places you are likely to store files. This panel is called the Place Bar. To customize it open Regedit and navigate to HKey_Current_User\Software\Microsoft\Office\9.0\Common\Open Files\Places\StandardPlaces. The dialog lets you display 5 icons so for every one you want to add, you must hide one of the standard ones (we'll get around that in a minute).

Beneath StandardPlaces is a key for every icon. Right click a key you don't want and select New | dword value. Name the value show and leave its default value. That icon will now be hidden. Add a new icon by right clicking the UserDefinedPlaces key and selecting New | Key. Give the key any name you like. Right click the new key and select New | String Value and name the value Name. Press enter and type in an appropriate name. Right click the key again and New | String Value and call this one Path. Set the value to the full path to the folder to use.

To show more than 5 icons, Right click the Places key and select New | Dword value. Name the value ItemSize and leave it with a default value. The icons will now be smaller and will allow more than 5 in the place bar.

API to Get Hard Drive Serial Number
Use this code to get a hard drive, floppy, CD-ROM, ... serial number.

   Private Declare Function GetVolumeInformation _
       Lib "kernel32" Alias "GetVolumeInformationA" _
       (ByVal lpRootPathName As String, _
       ByVal pVolumeNameBuffer As String, _
       ByVal nVolumeNameSize As Long, _
       lpVolumeSerialNumber As Long, _
       lpMaxComponentLentgh As Long, _
       lpFileSysyemFlags As Long, _
       ByVal lpFileSystemBuffername As String, _
       ByVal nFileSystemNameSize As Long) As Long
   
   Public Function GetSerialNumber(ByVal sDrive As String) As Long

     If Len(sDrive) Then
        If InStr(sDrive, "\\") = 1 Then
           'Make sure we end in backslash for UNC
           If Right$(sDrive, 1) <> "\" Then
               sDrive = sDrive & "\"
           End If
        Else
           'If not UNC take first letter as drive
           sDrive = Left$(sDrive, 1) & ":\"
        End If
     Else
        'Use current drive
        sDrive = vbNullString
     End If
                               
     Call GetVolumeInformation(sDrive, vbNullString, 0, GetSerialNumber, ByVal 0&, _
         ByVal 0&, vbNullString, 0)
   End Function

   Private Sub Command1_Click()
      Dim sDrive As String
      
      sDrive = InputBox("Enter drive for checking SN")
      MsgBox Hex$(GetSerialNumber(sDrive))
   End Sub



About TheScarms
About TheScarms


Sample code
version info

If you use this code, please mention "www.TheScarms.com"

Email this page


© Copyright 2024 TheScarms
Goto top of page