Entering Non-Printable ASCII Characters Into Text Files Under Windows (With MS-DOS Editor)

June 24, 2010

When editing a text file in Windows it is sometimes necessary to embed special non-printable ASCII control characters into the text. This is quite difficult in modern Windows versions. Windows does not allow any way to enter codes below code 032 (space) into standard text fields. Newer NT based versions of Windows also use UNICODE strings internally, which does not support lower ASCII control codes.

Notepad supports entering some of the character codes using ALT key codes. You hold down the ALT key and enter in the three digit ASCII code for the character on the numeric keypad. Number Lock must be turned on and you have to enter the numeric code on the numeric keypad (it will not work using the regular number keys). For example, to enter in a carriage return you can use ALT+013 or to enter in a line feed character, you can use ALT+010. Notepad allows a few ASCII control codes to be entered this way, but you cannot use all of them.

The best way that I’ve found is to use the MS-DOS Editor program (edit.com). MS-DOS Editor is still included with all 32-bit version of Windows. You can open it by entering ‘edit’ in the run box or command prompt.

In MS-DOS Edit you can use CTRL-P and then enter an ASCII control code which will be embedded into the text file. You can enter the code as an ALT key code or an ASCII control code,  a list of ASCII control codes is available here. So to enter the Form Feed character for example, you would press CTRL-P and then CTRL-L (or CTRL-P and ALT+012). It will place a symbol in the editor to represent the non-printable ASCII character. When you save the file in the MS-DOS Editor it will save the embedded character codes in the text file.

Once the file is saved you can re-open it in a Windows editor which supports ASCII text files like Notepad or ConTEXT. The symbol will be displayed in the editor and you can copy and paste it into other text files to embed the control code into them.

Be warned that many Windows programs and text boxes may attempt to convert the character code into something else when you copy and paste it (I believe it may have to do with Windows converting it to UNICODE). For example, when I copied the form feed (code 12) character directly from a console running DOS Edit, it pasted into other Windows applications as “?” (code 63). Notepad even displayed a similar character to the one in DOS Edit but it still was as a different character (not code 12) when I checked. Also, when I copied the character from a file opened in ConTEXT, it pasted into Notepad properly (as code 12), but pasted into the Visual Studio IDE as “?” (code 63).

Advertisements

Installing Windows Live Suite 2010 Wave 4 Beta

June 17, 2010

The beta release of the next Windows Live suite of applications has been leaked to the internet and is available for download. It can be installed on a regular system with no issues, but there are problems with the login process. The wave 4 applications detect that your Windows Live account is not part of the wave 4 beta program and will prevent you from logging in unless you sign up for the “dogfood” program (Microsoft employees only!). There are patches available to get most of the wave 4 applications to login with a regular account. A public beta of the suite will hopefully be available soon.

You can download a good torrent with the installer and required patches here.

The Windows Live Essentials installer is about 126MB and works offline (doesn’t download any components). The installer includes the following Windows Live applications: Windows Live ID, Windows Live Messenger (15.2.2583.119), Windows Live Call (part of messenger), Windows Live Mail (15.2.2583.119), Windows Live Contacts (part of Windows Live Mail), Windows Live Companion (15.2.2583.119), Windows Live Writer (15.2.2583.119), Windows Live Photo Gallery (15.2.2590.301), Windows Live Movie Maker, Windows Live Family Safety, Windows Live Sync, Microsoft Outlook Connector, Bing Bar (replaces the MSN Search Toolbar/Windows Live Toolbar). Windows Live SkyDrive has been integrated into the web interfaces for hosting photos and documents and also can now stream video.  Windows Live Mesh is still a separate beta but many of it’s features have been moved into Windows Live Sync. There may be other updates to the web based applications like Live Mail (Hotmail) and Spaces, but they are not available without a valid beta participation account.

Main Issues With the Wave 4 Beta

  • Windows Live Sync which requires a valid beta account and doesn’t run.
  • Windows Live Photo Gallery will work but cannot login to the network (also requires a valid account).
  • Windows Live Movie Maker requires an Aero compatible video card or it will not run at all.
  • Some of the applications crash at times (they are still beta!).

Overall, the applications run fairly well and perform decently. There are probably features that are still missing (like ribbon customization) but they are decent enough quality that they were released to Microsoft employees for testing.

 

Installing the Windows Live Essentials Wave 4 and Patches

  1. Extract the RAR archive from the torrent and run the Windows Live Essentials installer named “run this first.exe”. Select the components you would like and proceed through the installation process.
  2. Make sure that no Windows Live applications are running, if they are make sure you exit them.
  3. Open the XML file “then run this second.xml”, it will open up in Internet Explorer and the information bar will pop up and tell you it has blocked running active content on your computer (picture).
  4. Click the information bar and select the option to run the content. After the page reloads it should be installed.
  5. Finally, run the patch named “then run this patch lastly.exe” and install it.
  6. Restart your computer. After rebooting you should be able to use the new Windows Live betas!

(You do not have to worry about the Internet Explorer 9 tech preview installer that is also included in the archive)

New Features

The main feature is the new ribbon interface which has been added to Windows Live Photo Gallery, Windows Live Mail and Windows Live Writer. Many of the apps have moved things to the ribbon or to new side panes. There are new view and sorting options for many applications.

The new social integration features (like FaceBook updates) have been integrated into Windows Live and there are better publishing options as well. Live Messenger now supports tabbed conversation windows (like Lotus Sametime) and a new Social Mode.

Windows Live Writer adds better account support and blog sites can provide links to services and extensions which are available in the editor. You can create custom manifest files which define features for other types of blog sites. Editing is much easier with the options on the ribbon (rather than under menus) and plugin features are more accessible. You can also configure advanced permissions for posts like allowing comments and pings from the editor.

Windows Live Photo Gallery adds GeoTags (location tags) and many additional photo editing tools. The ribbon also makes working with tags and other meta data much easier.

Other Notes

  • Windows Live Mail is prone to crashes when switching between the shortcuts (the lower right icons for Calendar, Contacts, Feeds…).
  • Various Windows Live Writer plugins may cause it to crash, but most of them have no problem. Unfortunately there is no published command line option for running Live Writer without plug-ins so you can use the GUI to manage them. You will have to manually remove the offending plugin from the “C:\Program Files\Windows Live Writer\Plugins” folder. If they are in another location they may be COM objects and you should run their uninstall program to unregister them (or use “regsvr32 /u <DLL FILE NAME>” to do it manually).
  • All of the tested Windows Live Photo Gallery plug-ins worked properly.
  • A-Patch is an application which patches Live Messenger to remove adds and change other features like nudge delay and maximum file transfers. There is no version of a-patch which will patch the beta version of Live Messenger yet.
  • Microsoft beta’s often do not update automatically to the full release and may require you manually uninstall the beta from Programs and Features (appwiz.cpl) before you can install the release version (when it comes out).

Conclusion

The new Windows Live beta applications are pretty nice and I personally like the new versions enough that I will use them instead of the old versions on my systems. This post was written and published in the beta Windows Live Writer.

I would not recommend installing it for every user, especially with the sign-in issue and possible crashes. Some of the earlier Windows Live betas (like the first Windows Live releases, and wave 3) were good enough that the betas could be installed for most users. I don’t feel this release is good enough quality yet.


Visual Basic 6.0: Docking a Child Form Inside a Parent Form With SetParent.

June 10, 2010

This is a quick and easy example of how to dock the contents from a child form into a parent form.

You can see Window docking functionality in the Visual Basic 6.0 IDE if you drag a floating tool window (like the ToolBox, Project Explorer, Properties Editor, or Immediate) to one of the edges of the IDE. The window will snap to the edge and become docked with the main IDE window.

It’s actually very easy to place the contents from one form or container control into another one.

To start, create a new “Standard EXE” project in Visual Basic 6.0. Add a new standard Form (which will be the parent) and create a new PictureBox control on it. Set the Align property of the PictureBox to any direction (vbAlignTop, vbAlignBottom, vbAlignLeft, or vbAlignRight) so that it automatically negotiates and snaps to the edge of the form. Then create another standard form (which will be the child) and with whatever controls you’d like on it.

We will use the following API declarations:

Public Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Public Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long

These can be declared either as public within a shared module, or as private within any forms that call them. If you include the Windows API Type Library as a reference in your project, they will be automatically declared.

GetParent allows us to obtain the handle of an object’s parent. SetParent allows us to change an object’s parent container. Both functions take the hWnd of a form or control as input. GetParent takes the hWnd of the child container and returns the hWnd of it’s current parent. SetParent takes the hWnd of the child container as the first parameter and the hWnd of the new parent container as the second parameter, then returns the hWnd of the previous  parent on success.

Placing the contents of “Form2” into the “PictureBox1” control on “Form1” it is as easy as:

Call SetParent(Form2.hWnd, Form1.PictureBox1.hWnd)

Add this to the Form_Load event of your parent form along with a line to make the child form visible (either Form2.Show or Form2.Visible = True). You should see the form appear inside the picture box on the parent form.

Of course there is still a lot to be done before the window will work like it does in the Visual Basic IDE. You can move the child window around within the PictureBox and change it’s state. You cannot resize the picture box that contains the form by grabbing it’s edge. You also cannot drag the child form back out of the dock or to another side. All of this functionality will have to be coded and can be done in a few different ways.

I may discuss some of them in another post. This one is just a basic example which should give you an idea of how to get started.


Installing the Link Layer Topology Discovery (LLTD) Responder on Windows Server 2003

June 6, 2010

Under Windows Vista and higher it is possible to view a graphical map of your network by clicking “View Full Map” in the Network and Sharing Center or by using the command “explorer.exe ::{21ec2020-3aea-1069-a2dd-08002b30309d}\::{E7DE9B1A-7533-4556-9484-B26FB486475E}”. To build the network map, Windows queries each system on the network using the Link Layer Topology Discovery (LLTD) protocol.

The LLTD protocol was introduced in Vista. Unfortunately, older versions of Windows (like XP and Server 2003) that don’t have the LLTD protocol installed will not respond to network map requests, and will not show up at all on the network map display. Microsoft has provided the Link Layer Topology Discovery (LLTD) Responder (KB922120) update package which can be installed on Windows XP systems to have them show up properly under the network map. Microsoft did not release a version of the LLTD responder for Windows Server 2003. The XP release of the LLTD Responder will work fine on Windows Server 2003, but you have to install it manually.

First you will need to download the “Link Layer Topology Discovery (LLTD) Responder (KB922120)” update package for Windows XP (WindowsXP-KB922120-v5-x86-ENU.exe).

Extract the contents of the installer package using the –x switch (WindowsXP-KB922120-v5-x86-ENU.exe -x). It will ask you for a location and extract it’s contents there.

Inside the directory where the package was extracted there will be a “SP2QFE” subdirectory which contains the files we need to copy:

  1. Copy the “rspndr.exe” file from the SP2QFE subdirectory into the “%SystemRoot%\system32” directory.
  2. Copy the “rspndr.sys” file from the “SP2QFE” subdirectory to the “%SystemRoot%\system32\drivers” directory.
  3. Copy the “rspndr.adm” and “rspndr.inf” files inside the “SP2QFE\IP” subdirectory into the “%SystemRoot%\INF” directory.

After the files are copied, run the command “rspndr –i” to install the driver’s entries in the system registry and start it (net start rspndr).

There should now be a new protocol entry for “Link-Layer Topology Discovery Responder” under your network adapter’s properties, and your Windows Server machine should show up on the network map.


Adding Custom Entries to the Windows Components Wizard in Windows XP

June 3, 2010

About the Windows Component Wizard

The Windows Component Wizard can be accessed from inside the “Add or Remove Programs” control panel (appwiz.cpl) in Windows XP. On the left hand side of the control panel (in the grey band) is a button to “Add/Remove Windows Components”, which will launch the Windows Components Wizard.

The wizard provides and manages a list Windows components and component groups which can be selected for installation or removal. Each item can be checked or uncheck to control it’s installation status. Once the user has selected the configuration they want, they can click the “Next” button and the wizard will perform all of the chosen installation or removal tasks.

About the Sysoc.inf File

All of the entries which are displayed in the Wizard are contained in the file “sysoc.inf” which is stored under the %WinDir%\INF directory (The INF directory may be hidden on some systems, but you can quickly open it by typing “INF” in the Run box).

Many people who tweak XP will recognize this file, as it has hidden components which are not listed in the Wizard (like Windows Messenger) which can be made visible by editing the entries in this file (and then removed using the wizard).

The file can also be used by the System Stand-Alone Component Manager (SYSOCMGR.EXE) tool which is included with Windows 2000 or higher for the unattended addition or removal of Windows components.

The Sysoc.inf Entries

If you open up the file you will see a bunch of INF code. INF is an installation scripting language which looks much more complicated than it actually is. If you’d like to learn about INF files, MSDN has some good documentation here.

Inside the file will be a [Version] section which we don’t have to worry about. The section we want to look at is [Components]. Those are the entries which form the root listing of the Components Wizard.

Each entry will have the following format:

[Component]=[DLL Name],[DLL Entry Point],[INF File],[hide],[Number]

Component is the internal name which is used to reference the component in the INF files. I’m not 100% sure what the  DLL name and entry point are for (probably setup procedures). The INF file is a separate INF which contains the component details and installation script. The hide entry is used to hide the item in the Wizard, or is left empty when the item is visible. I don’t know what the last number is for either, it usually is 7. All of the values are required except ‘hide’.

For example, in the line for Windows Messenger:

msmsgs=msgrocm.dll,OcEntry,msmsgs.inf,hide,7

‘msmsgs’ is the internal name which is used to refer to the component within the INF files. msgrocm.dll and OcEntry are the DLL file and entry point. The next item is the INF file (msmsgs.inf) which contains the component’s information and installation code. The hide entry means it will not show up in the Component Wizard. Finally, there is the number 7.

The Component INF Entries

If you open up one of the component INF files which is referenced in sysoc.inf, you will see INF code which describes the component or group, and the code which is used to install or remove the component.

The first section that is unique is [OptionalComponents]. This section contains all of the internal component names, with the first being the top level option, and all of it’s child components after. I believe this defines the items in a group, but have not confirmed it yet.

The component name used in the sysoc.inf line will be the name of the section which contains the component information. For example, the Windows Messenger line listed above specifies the component name as ‘msmsgs’, That means the messenger component’s information will be found under the [msmsgs] section in the msmsgs.inf file.

Under the component’s section will be several directives. The following directives control what is displayed under the Component Wizard:

OptionDesc Display name of the component.
Tip Description of the component.
Uninstall The INF section used to uninstall component.
InstallType Number (Don’t know what it means)
IconIndex Index of icon within a Windows DLL (shell32.dll?)
Modes Comma separated numbers (don’t know)
SizeApproximation Approximate size (in bytes) of installation.
Parent Name of parent group.

The remaining section lines are standard INF directives which are used for the component’s installation process.

After you look at a couple of the component INF’s you should get a decent idea of how they work. Now we move on to:

Adding Your Own Entries

In order to add your own components you will first need to add a new entry under the [Components] section of sysoc.inf.

WARNING: If you edit the sysoc.inf file incorrectly, it will cause the Windows Components Wizard to crash or close unexpectedly. Make sure you backup the sysoc.inf file (or any others) before you modify them.

You can add your entry anywhere under the [Components] section. Make sure your component name is unique. For the DLL name and entry point you can use “ocgen.dll” and “OcEntry”. Some of the others can cause crashes, but I have used OcEntry many times and have had no problems. It may even be a dummy function call, many other items in sysoc.inf use it. Enter the name of your component’s INF file. You can include your component section within an existing INF file, or create a new one. You can leave the next value empty, or put in “hide” if you want it to be hidden. For the final value put 7.

Here’s an example of a custom component sysoc entry to install the Visual Basic 1.0 runtime library:

[Components]
vbrun10=ogen.dll,OcEntry,vbrun10.inf,,7

After that you will need to create your component’s section in the specified INF file and set it’s options. If you are creating a new INF file for your component you will need to also have the [Versions] section with the Signature=”$WINDOWS NT$” directive as a minimum. You should be able to test it in the wizard at this point to see how it looks. The final steps will be to write the installation code and make sure it all works.

For our example component, here’s the INF:

[Version]
Signature = $WINDOWS NT$

[DestinationDirs]
1=

[vbrun10]
OptionDesc = %CAPTION%
Tip = %INFO%
Uninstall = vbrun10_uninstall
IconIndex = 34
Modes = 0,1,2,3
SizeApproximation = 151552
CopyFiles = vbrun10_copyfiles

[vbrun10_copyfiles]
vbrun10.dll,,,

[vbrun10_uninstall]
DelFiles

[Strings]
CAPTION = "Visual Basic 1.0 Runtime"
INFO = "Allows you to run Visual Basic 1.0 applications."


Compaq Presario 2100 Notebook Drivers for 32-bit Windows Vista

June 3, 2010

The Compaq Presario 2100 Notebook is an older model notebook which runs Windows Vista surprisingly well. The main problem is getting Vista compatible drivers for all of the hardware. HP’s support site only has Presario 2100 drivers for Windows 2000 and Windows XP. After some searching, mixing, and matching…I have been able to locate Vista compatible drivers for all of the hardware on my Presario 2100.

I’ve provided some information about the hardware and links to download the drivers below. I’m currently running this configuration on my Presario 2100 and it is fairly fast and stable (aside from the UAC issue at the bottom of this post). IMHO it actually runs better than XP did!

NOTE: There are many different models of the Presario 2100 series notebook. There may be differences between the model you have and my system (an AMD based Presario 2100 – P/N: DS526U#ABL). Some of the information here may not be correct for your particular model (and may not work!).

Processor:

Mobile AMD Athlon XP2500+ 1.87Ghz

The drivers are included with Vista and are installed automatically.

Chipset:

ATI IGP 320M NorthBridge

There generic drivers included with Vista will work and are installed automatically.

CardBus Controller:

O2Micro OZ6912/601/711E0 (HWID: VEN_1217&DEV_6972)

The drivers are included with Vista and are installed automatically.

IDE/ATA Controller:

ALi/ULi M5229 (HWID: VEN_19B9&DEV_5229)

The drivers are included with Vista and are installed automatically.

You can also download the ULi_Integrated220.zip package from NVIDIA’s ULi Drivers page. Version 2.20 of the ULi Integrated Drivers includes support for Vista. The ones included with

Video:

ATI U1/A3 Accelerated Graphics Port (HWID: VEN_1002&DEV_700F)

Download the sp28073.exe package (ATI U1/RS200 AGP Bus Driver) from HP’s download site. Extract the package contents and run the setup.exe application. The program will not show any windows but should silently install the ATI GART driver.

To confirm it has been installed, open Device Manager and look under the “System devices” section. There should be an entry for “ATI U1/A3 Accelerated Graphics Port” instead of “PCI to PCI Bridge”.

ATI Radeon IGP 320M Display Adapter (VEN_1002&DEV_4336)

Download the sp27665.exe package from the HP download site. Extract the package contents and run the setup application. It will report that it failed to install. Once it closes the Application Compatibility Assistant will ask if the program installed successfully, select “Reinstall using the recommended settings”. The setup will launch again and will install the driver successfully. Restart the computer to complete the installation.

To confirm it has been installed properly, open the Device Manager and look under the “Display adapters” section. It should read “ATI RADEON IGP 320M” instead of the “Standard VGA Adapter”.

The ATI Control Panel doesn’t work properly under Vista and can be uninstalled from the Programs and Features control panel.

Audio:

Conexant AC-Link Audio (HWID: VEN_109&DEV_5451).

There are many different AC-Link drivers available but most of them don’t work correctly and report a code 10 in Device Manager. I was able to find one set that works properly.

Download the sp23455.exe package from HP. Extract it’s contents to a directory and run setup.exe. When it shows you the empty installation list, click the cancel button. Once it exits the Program Compatibility Assistant will ask you if the program installed correctly. Choose “Reinstall using the recommended settings”. The installer will run again and the drivers will install properly.

Ethernet:

National Semiconductor DP83815/816 “MacPhyter” (HWID: VEN_100B_DEV0020)

The sp25618.exe package on the HP download site will install the ethernet drivers without any problems. The XP drivers available on National Semiconductor’s web site will also work.

Modem:

Conexant AC-Link HSF Modem (HWID: VEN_10B9&DEV_5457)

Download the hsfac97.zip package from Conexant. Extract the archive to a directory and run the HXFSetup.exe program inside as Administrator to install the modem.

Touchpad:

Synaptics PS2 Port TouchPad

Vista compatible drivers are available on the Synaptics driver page.

Keyboard:

OneTouch Keyboard Buttons

The OneTouch drivers are installed as part of the Notebook Utilities. Download the sp23604.exe package from HP’s download site. Extract the contents and run the setup.exe installation program.

UAC Lock Up Issue:

I have found that the system sometimes locks up completely when the UAC prompt is displayed. You should disable UAC to prevent the issue. The system runs perfectly stable otherwise (as long as you avoid the UAC prompts). I suspect it is related to the video/GART driver.

You can disable UAC under the User Accounts control panel, under the option “Turn User Account Control on or Off”. There are additional methods you can also use listed here. Please be aware that there are additional security implications if UAC is turned off!

A possible workaround may be to use an alternate UAC application, like the freeware Norton UAC. I haven’t had a chance to try this yet.


Bypassing the Annoying Policy Settings on My Workstation

June 3, 2010

A lot of people in IT complain about Windows being unstable and insecure, but they probably aren’t running the system in a correct and secure fashion. I found a perfect example of this while I was working for a major PC manufacturer not too long ago. I had a workstation that was locked down with the absolute worst policy settings. Obviously some admin just went nuts with the policy editor, while having no clue about actual Windows security.

First off, the ‘Run’ menu was disabled. I hate when people do this because I honestly use the Run box for launching everything in Windows…even Word. Let me tell you now…disabling the ‘Run’ menu does nothing for security at all. You have to secure the system by properly restricting a user’s access so that their commands can’t do anything harmful. Disabling the box they use to launch the commands provides no security at all. There’s a million other ways to get the system to execute commands.

Getting around it on my workstation was as easy as launching CMD.EXE from a shortcut and using the ‘start’ command (which works almost exactly like the Run box).

Even if CMD.EXE had been unavailable, I could have easily written a short VBScript that passes the contents of an InputBox to the Windows Script Host’s Run command.

The second useless policy was the one that wouldn’t let me open my C: or C:\Windows folder by double-clicking them from Explorer. Yes you read right, the admin didn’t secure the disk/file/folder permissions, he just set the policy which prevents people from opening them directly under the “My Computer” icon.

So I could still use commands like “explorer /root,C:\”, which would cause Explorer to happily display the hard disk contents in a new window (more info on Explorer’s command line options is available here). Of course I could also freely manipulate the files from CMD.EXE or any application’s open dialog as well.

The only setting which was an actual hurdle was the policy setting which prevented me from running the system registry editor. There was no clever built-in hack that I could use to bypass this setting. I was still able to easily get around it however. I simply downloaded a third party registry editor which didn’t acknowledge the policy setting.

In fact, there are many available stand-alone Windows applications which can replace the Windows functionality that the above policies had disabled. If you browse a site like Shell Extension City, you’ll find software that would adequately bypass all of them.

I guess the point of this post is to show how easy it is to get around on Windows when it’s not secured properly. Windows policies can be very powerful when used correctly…but they should never be the first and only line of defense on your systems!