A couple of things about those functions:
1) Function GetReadNames seems to be completelly useless. I can´t make this stupidity to work on WinXPand all it does it check on the register for theconvertersavailable and supposedly register a new one (HTML.iec with only HTML data to be converted - no RTF, doc, Lotus etc etc). The documentation itself says to choose to use FRegisterConverter insetad....but...
All function FRegisterConverter is to create a new key on the register to insert the path, name and extension for the HTMLdata. So, for this to work weneed to do something like:
call EnumSubKeys esi, &HKEY_LOCAL_MACHINE, {B$ "SOFTWARE\Microsoft\Shared Tools\Text Converters\Import\Lotus123", 0}
call 'html.iec.FRegisterConverter' D$esi ; this create a newkey for each subkey. EX: on Lotus123 it will create a IMport/ExportSubkeys to HTML.iec
_________________________________________
Proc EnumSubKeys:
Arguments @phKey, @dwKey, @szSubKey
Local @cSubKeys
Uses ebx, ecx, edx, esi
mov esi D@phKey
mov D$esi 0
call 'advapi32.RegOpenKeyExA' &HKEY_LOCAL_MACHINE, D@szSubKey, 0, &KEY_ALL_ACCESS, esi
..If eax = &ERROR_SUCCESS
mov D@cSubKeys 0
lea ebx D@cSubKeys
call 'advapi32.RegQueryInfoKeyA' D$esi, &NULL, &NULL, &NULL, ebx, &NULL, &NULL,
&NULL, &NULL, &NULL, &NULL, &NULL
If eax = &ERROR_SUCCESS
mov eax D$ebx
Else
xor eax eax
End_If
..Else
xor eax eax
..End_If
EndP
This will create a key with the following specifications
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Text Converters\Import\HTML\Text Converters]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Text Converters\Import\HTML\Text Converters\Export]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Text Converters\Import\HTML\Text Converters\Export\HTML]
"Extensions"="htm html htx"
"Name"=""
"Path"="C:\\temp\\HTML.iec"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Text Converters\Import\HTML\Text Converters\Import]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Text Converters\Import\HTML\Text Converters\Import\HTML]
"Extensions"="htm html htx otm"
"Name"=""
"Path"="C:\\temp\\HTML.iec"
If path is {B$ "SOFTWARE\Microsoft\Shared Tools\Text Converters\Import\Lotus123", 0} will use Lotus123 to save the new key
If Path is {B$ "SOFTWARE\Microsoft\Shared Tools\Text Converters\Import\Word12", 0} will use Word12 to save the new key
etc
If we set {B$ "SOFTWARE\Microsoft\Shared Tools\", 0} will use create the HTML.iec path as the new import/export converter to be used with. The problem is, it will overwritte any other converters with the same name.For instance i had on the converter path html32.cnv, that was saved onto the register. After applying the FRegisterConverter it replaces the html32.cnv with html.iec (which seems to be the same btw), except for the file versions
html.iec = 2018.0.0.23486
html32.cnv= 2003.1100.8165.0
both are: Microsoft HTML Converter, but html.iec is the newer one.
So, get FRegisterConverter and GetNames seems to be useless, because all they do is get the path for the converters, that can be used on a OpenDialog,for example to display a list of possible imports/exports extensions.
The only point of interest on this function is that it register newformats to be imported or exported for use with images inside html, by creting the KEys:
MSWORD
WINWORD
MSPUB
MSWORKS
WORDPAD
FRONTPG
So, if the register contains this keys, it will create the subkeys (text convert) as:
SOFTWARE\Microsoft\Shared Tools\Text Converters\Import\MSWORD\Text Converters\Import\
Which means that "MSWORD", "WINWORD" etc are the module names for this converter to work properly
Those are responsable for determining the type of Codepage for the exported/imported html files. he codePage that seems available are:
CP_UTF8
CP_950
CP_932
CP_949
CP_936
So, thinking on that we may add registry entries for MSWORD", "WINWORD etc and simply use them as paths for the InitConverter32 function choose which CodePagewill be outputed on html.iec.
For example, even if i don´t have winword installed, i can still usehtml.iec to produce a html from a RTF similar (if not equal) as if i had winword,simply adding a keyword on the registry such as:
SOFTWARE\Microsoft\Shared Tools\Text Converters\Import\MSWORD
and setting the values for path, name and description accordly.
2) Also since getreadnames are a pain to use and not work as expected and FRegisterConverter is not suitable if we already have other converters o the registry we can replace them with:
Proc GetReadNames::
Arguments @haszClass, @haszDescrip, @haszExt
Local @hKey, @Index
Uses esi, ecx, edx
mov D@hKey 0
lea esi D@hKey
call EnumSubKeys esi, &HKEY_LOCAL_MACHINE, {B$ "SOFTWARE\Microsoft\Shared Tools\Text Converters\Import", 0}
On eax = 0, ExitP
mov D@Index eax
call RegGetKeyValue D$esi, D@Index, D@haszClass, D@haszDescrip, D@haszExt
; close the main key before exiting
call 'advapi32.RegCloseKey' D$esi
EndP
Proc EnumSubKeys:
Arguments @phKey, @dwKey, @szSubKey
Local @cSubKeys
Uses ebx, ecx, edx, esi
mov esi D@phKey
mov D$esi 0
call 'advapi32.RegOpenKeyExA' &HKEY_LOCAL_MACHINE, D@szSubKey, 0, &KEY_ALL_ACCESS, esi
..If eax = &ERROR_SUCCESS
mov D@cSubKeys 0
lea ebx D@cSubKeys
call 'advapi32.RegQueryInfoKeyA' D$esi, &NULL, &NULL, &NULL, ebx, &NULL, &NULL,
&NULL, &NULL, &NULL, &NULL, &NULL
If eax = &ERROR_SUCCESS
mov eax D$ebx
Else
xor eax eax
End_If
..Else
xor eax eax
..End_If
EndP
[achKey: B$ 0 #Size_Of_String]
[lngData: B$ 0 #2000]
[lngDataLen: D$ 2000]
[VALENT:
VALENT.ve_valuename: D$ SzPath
VALENT.ve_valuelen: D$ Size_Of_String
VALENT.ve_valueptr: D$ 0
VALENT.ve_type: D$ ®_SZ
VALENT.ve_valuename2: D$ SzName
VALENT.ve_valuelen2: D$ Size_Of_String
VALENT.ve_valueptr2: D$ 0
VALENT.ve_type2: D$ ®_SZ
VALENT.ve_valuename3: D$ SzExtensions
VALENT.ve_valuelen3: D$ Size_Of_String
VALENT.ve_valueptr3: D$ 0
VALENT.ve_type3: D$ ®_SZ]
[SzPath: B$ "Path", 0]
[SzName: B$ "Name", 0]
[SzExtensions: B$ "Extensions", 0]
Proc RegGetKeyValue:
Arguments @dwKey, @Index, @haszClass, @haszDescrip, @haszExt
Local @cbName, @SubKeyLen, @lngDataLen, @NewIndex, @phKey2, @Path, @Descr, @Ext
Uses ebx, ecx, esi, edi, edx, eax
lea ebx D@cbName
mov D$ebx 255
mov edi D@haszClass | mov edi D$edi | mov D@Path edi
mov edi D@haszDescrip | mov edi D$edi | mov D@Descr edi
mov edi D@haszExt | mov edi D$edi | mov D@Ext edi
xor esi esi
.While esi < D@Index
; get the subkey name.Ex: HTML, Lotus123,
call 'advapi32.RegEnumKeyExA' D@dwKey, esi, achKey, ebx, &NULL, &NULL, &NULL, &NULL
...If eax = &ERROR_SUCCESS
lea edi D@phKey2
mov D$edi 0
call 'advapi32.RegOpenKeyExA' D@dwKey, achKey, 0, &KEY_ALL_ACCESS, edi
..If eax = &ERROR_SUCCESS
; get the values of the subkey and store them on the proper buffers
call 'advapi32.RegQueryMultipleValuesA' D$edi, VALENT, 3, lngData, lngDataLen
.If eax = &ERROR_SUCCESS
; Path
mov edi D@Path
call StrCpy D$VALENT.ve_valueptr, edi
mov edi D@Path | add edi Size_Of_String | mov D@Path edi
; Description
mov edi D@Descr
call StrCpy D$VALENT.ve_valueptr2, edi
mov edi D@Descr | add edi Size_Of_String | mov D@Descr edi
; Extension
mov edi D@Ext
call StrCpy D$VALENT.ve_valueptr3, edi
mov edi D@Ext | add edi Size_Of_String | mov D@Ext edi
call ClearBuffer lngData, 2000
.End_If
..End_If
; close this subkey on each loop
call 'advapi32.RegCloseKey' D$edi
...End_If
mov D$ebx Size_Of_String
inc esi
.End_While
EndP
The GetReadNames function can handle 160 converters and their parameters are pointers to an array of strinsg related to path,description and extension. Exampleof usage:
[Teste1: D$ SzPath]
[Teste2: D$ SzDescription]
[Teste3: D$ SzExtension]
[SzPath: B$ ? #(160*Size_Of_String)]
[SzDescription: B$ ? #(160*Size_Of_String)]
[SzExtension: B$ ? #(160*Size_Of_String)]
[Size_Of_String 255]
call GetReadNames Teste1, Teste2, Teste3