PDA

View Full Version : Registry problem again



Michael Clease
14-07-2015, 12:56
Hello Eros,

The old registry bug has appeared again ???, Registry_GetAllKeys seems stuck in a loop.

I am using Version 1.9.15.0



Uses "UI","COMM","REGISTRY"
' -- ID numbers of controls


Global sComPorts(200) As String


Function TBMain()


GetComports(10)


End Function

Function GetComPorts(CBHNDL As DWord)
Local N,M As DWord
Local nIdx As DWord
Local sBuffer As String
Local sPorts() As String

If Registry_PathExists("HKEYLM", "hardware\devicemap\serialcomm") Then
sBuffer = Registry_GetAllKeys("HKEYLM", "hardware\devicemap\serialcomm") '<<<<< Stuck in loop (again) ???
Split(Buffer,$CRLF,Ports)
If UBound(sPorts) <> UBound(sComPorts) Then
ReDim sComPorts(UBound(sPorts))
For n = 1 To UBound(sPorts)
sComPorts(n) = Remain$(sPorts(n),"=")
Next
EndIf
EndIf
End Function

Petr Schreiber
14-07-2015, 21:01
Hi Mike,

I can confirm the problem.

Here is another example to replicate, on PC without COM ports (+advantage of killability with Ctrl-C in console):


Uses "Registry", "Console"

Function TBMain()

$RegPath = "hardware\devicemap\video"
If Registry_PathExists("HKEYLM", $RegPath) Then
Print "About to scan for keys..."
String sBuffer = Registry_GetAllKeys("HKEYLM", $RegPath)
PrintL "DONE" In 10 ' -- Does not happen now, thanks to stuck behavior
Else
PrintL "You need to adjust the $RegPath to something existing on your PC" In 12
End If

PrintL
PrintL "Press any key to quit..."
WaitKey

End Function


Petr

Petr Schreiber
14-07-2015, 21:22
Mike,

I prepared a hotfix for you. Please use the attached thinBASIC_RegistryFix module, below is usage:


Uses "Registry", "RegistryFix", "Console"

Function TBMain()

$RegPath = "hardware\devicemap\video"
If Registry_PathExists("HKEYLM", $RegPath) Then
Print "About to scan for keys..."
String sBuffer = RegistryFix_GetAllKeys("HKEYLM", $RegPath) ' -- This is the only function in RegistryFix "module"
PrintL "DONE" In 10
PrintL sBuffer
Else
PrintL "You need to adjust the $RegPath to something existing on your PC" In 12
End If

PrintL
PrintL "Press any key to quit..."
WaitKey

End Function


Let me know if it helps. Of course, fix directly in Registry module will be better - if my fix helps, I will guide Eros further.


Petr

ErosOlmi
14-07-2015, 22:24
:) Thanks Petr.

Here attached a semi official fix of original module.
Please download and substitute the one you have into \thinBasic\Lib\

Let me know if it works.

Ciao
Eros

PS: Back from my holidays I think I will publish many of the thinBasic modules as sources into Github at https://github.com/ErosOlmi/ThinBASIC_On_GitHub

Michael Clease
14-07-2015, 22:47
Thanks guys, it works great.

Eros I haven't done any work with TB for a while, i've been playing with python and discovering its a horrible language if your used to fixed data types.

thanks.

Petr Schreiber
14-07-2015, 23:24
Hi Mike,

I've been using Ruby at work extensively lately - some inspiring stuff I would like to bring to ThinBASIC, but the absence of types... it is not ellegant, it is sheer horror :D

Eros, I did minor cleanup of the thinRegistry now, let the GitHub party begins :). I also added thinCore.inc there, so it is possible to checkout repo and compile immediately.


Petr

Billbo
16-07-2015, 17:25
Eros,

Please clear up something for me. I have a way to tell a file's version. The old thinBasic_Registry.dll was 1.9.15.0 and yours is 1.916.0. Does thinBasic check version compatability? The other question is the thinBasic_Registry.dll at your link about above is two days old, version 1.9.15.0, and over 47k in size. Is yours 17,408 because the one at the link has 'large chunks of commented out code?' BTW Yours is the same size as the one I just replaced.

Bill

ErosOlmi
16-07-2015, 17:59
This was a quick fix of the module. I had 1.9.16.0 ongoing so I've used that version number to publish this module.
Module version is not important, the only important version is the version of Core module (thinCore.dll)

Regarding sources at Github, last update was performed by Petr, not by me. I will update when back from holidays.
Regarding size, my version of module DLLs are always compressed by UPX so when I will update Github size will be much smaller.

Anyway from September 2015 I will start publishing almost all thinBasic modules sources into Github.

Ciao
Eros

Billbo
16-07-2015, 18:26
Eros,

Thanks for the speedy reply. Watch out for the water shortage in California. The state settled with Tom Selleck for stealing it. He had to pay several thousand dollars.

Have a nice vacation.

Bill