Tuesday, May 24, 2011

SQL - Quick List of Tables

Another SQL reminder - for a quick list of tables...

select * from information_schema.tables where table_type='base table'

SQL - Display All Tables & Columns

Just as a reminder for those databases that you inherit that lack any sort of documentation....

SELECT SO.NAME AS table_name, SC.NAME AS column_name
FROM SYS.OBJECTS SO INNER JOIN SYS.COLUMNS SC
ON SO.OBJECT_ID = SC.OBJECT_ID
WHERE SO.TYPE = 'U'
ORDER BY SO.NAME, SC.NAME

Monday, May 23, 2011

Decompiling a CHM (Compiled HTML) File

HTMLHelp command-line

HH.EXE is distributed with HTML Help so you can rely on it being present. It lives in the Windows folder and has a limited number of command-line options. HH.EXE is associated with .CHM files. So double-click a *.CHM file and Windows will open the file using HH.EXE. Its a very small file, it mostly passes the help filename onto a HH API library. HH.EXE is not single instance, if you open a CHM file three times using HH.EXE, then three help windows will appear.

Example of using HH.EXE to decompile a CHM help file

Command line from a DOS window:
C:\HH.EXE -decompile D:/xTemp/decompile-folder C:/xTemp/XMLconvert.chm
Call from batch command file:
HH.EXE -decompile D:/xTemp/decompile-folder C:/xTemp/XMLconvert.chm
HH.EXE -decompile decompile-folder file.chm where "decompile-folder" is the directory to put the files into. This could be simply "."

Decompiling the file produces a slew of HTML and image files, together with the table of contents (.hhc) file, index (.hhk) file, and a few other supporting files.

One thing to note is that the decompile/recompile process isn't a "round-trip" process. Certain features that the help author added to the original help file can't be recovered when you decompile it, so these may no longer work properly after you've recompiled. This is especially true in the area of context-sensitive help, which may be broken in the new version of the file.