Hello all,

I wonder if somebody can make sense of this rather baffling problem I've 
encountered. I'm taking an exported registry file, and 
stripping out the control codes and empty bytes. However, som of the resulting 
text that this leaves behind is strangely truncated, 
and I'm blowed if I know why.

The export is started using, for example

    Shell "regedit /E " & "C:\local " & "HKEY_LOCAL_MACHINE"

This exports the LOCAL_MACHINE hive to the file c:\local

The output has extra bytes, presumably used for some arcane windows 
purpose, e.g.:

    "fig1.jpg"

I then open this file using the system object, strip out any characters of 
Ascii value < 32, so that what remains is simple text.

    For i = 1 To Len(line)
       If Asc(Mid$(line, i, 1)) > 31 Then
          cleanline = Cleanline & Mid$(line, i, 1)
       End If
    Next i

BY and large this works fine - I end up with simple text versions of the hives 
that I can then use later in the application. However, 
oddly, every now and then I find a line that part of the start missing, 
seemingly at random (well there's no pattern I can spot). 

To put it in context, I process some 500,000 lines and around 7000 are broken. 
Here's the kicker though - these 
lines appear to have nothing in common, there's no obvious pattern to what's 
happening, the error lines are unevenly and seemingly 
randomly dispersed through the files, there are no control codes or anything 
odd in the registry export files that appear to trigger 
the error (and the stripper code is straightforward anyway). In short, I can't 
see any rhyme or reason for the error. The source 
file is consistent, the stripping algorythm is consistent, the output has 
random errors in it.

A sample from the cleaned file:

    [HKEY_CURRENT_USER\Control Panel\PowerCfg\PowerPolicies\3]
    "Name"="Always On"
    have network wakeup hardware."
    
"Policies"=hex:01,00,00,00,02,00,00,00,01,00,00,00,00,00,00,00,02,00,00,00,00,\
      
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,32,32,00,00,04,00,00,00,04,00,\
      
00,00,00,00,00,00,00,00,00,00,b0,04,00,00,84,03,00,00,00,00,00,00,08,07,00,\
      00,00,01,64,64,64,64,00,00

See how the lines are all correct apart from the line "have network wakeup 
hardware."". This should read:

"Description"="This scheme keeps the computer running so that it can be 
accessed from the network.  Use this scheme if you do not 
have network wakeup hardware."

There will be odd lines here and there dispersed through the file that are 
truncated in this way, but I can't see any cause for it.

If anybody has any idea where to start looking for a cause I'd be extremely 
greatful.

Cheers
Colin

-- 
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm



[Non-text portions of this message have been removed]







'// =======================================================
    Rules : http://ReliableAnswers.com/List/Rules.asp
    Home  : http://groups.yahoo.com/group/vbHelp/
    =======================================================
    Post  : [email protected]
    Join  : [EMAIL PROTECTED]
    Leave : [EMAIL PROTECTED]
'// =======================================================
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/vbhelp/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to