Geej

Defraging sysoc.inf in your SOURCESS

32 posts in this topic

I made this autoit utility (DefragSysoc.exe) to defrag sysoc.inf (In SOURCESS\I386\SYSOC.IN_) after HFSLIP has added new entries to the end of sysoc.inf.

The purpose is to prevent potential bugs/error message to appear when application uses uninstall section of the inf and update the entries in sysoc.inf.

When 2 applications are uninstalled via it's inf, the whole portion of [Components] section added by HFSLIP is wipe out. (I think XP does not know how to process more than 1 [Components] section.) The error message appears when you click on "Add/Removes Windows Components" in Add/Remove Programs.

To prevent this, the [Components] section need to defrag. I think nlite & RMVi called it optimizing sysoc.inf. I called it defrag sysoc.inf since everyone understood what 'defrag' generally means :)

- Put DefragSysoc.exe in HFTOOLS (will only work from this location)

- Create HFSLIP_POST_DefragSysoc.cmd in HFTOOLS, with code or DL the simple cmd attachment

"%~dp0DefragSysoc.exe"

HFSLIP_POST_DefragSysoc.cmd

DefragSysoc.exe now match mulitple [Components] section's items using regular expression:

$sCmpList=StringRegExp (FileRead ($FHopen),'(.*=[^\d].*,\s?\d)',3)

*Pls feedback if the regular expression match or miss some strings that is not part of [Components] items.

A backup copy is created in SOURCESS\I386\SYSYOCBAK.IN_ just in case.

This is the exact copy that HFSLIP created. (When expand, it's filename is SYSOC.INF, and not SYSOCBAK.INF)

DefragSysoc.exe includes some error handling situation. In such event, no changes will be made to your SYSOC.IN_

Error message will pop up, required user to acknowledge the problem found and script will exit.

DefragSysoc.exe will run silently/unattended if no problems are found and can defrag successfully.

A defraged sysoc.in_ file size should be smaller than SYSOCBAK.IN_

====Edit3:Add: /nobackup switch if you wish SYSOCBAK.IN_ to be deleted.

Change HFSLIP_POST_DefragSysoc.cmd to

"%~dp0DefragSysoc.exe" /nobackup

Add defrag runtime when use with /nobackup via DefragSysoc.log (loc in HFTOOLS)(DefragSysoc.exe generally runs under < 1 sec)

Pls test in virtual machine to verify.

I tested in XP Pro with hfslip-1.7.10_beta_J.

Hope this is useful... :)

DefragSysoc.exe

Icondownload.png

Size: 356.97 Kb (365,541 bytes)

MD5: DF26D700B1882EEFB6C1840745F8303E

Compare_thumb.png

Edited by Geej
0

Share this post


Link to post
Share on other sites

Environment:

Base is Windows XP Pro Gold (aka Service Pack 0).

Integrating SP3, IE8, WMP11, RDC7, and most other updates.

Did not use HFCleanup or nLite.

Having experienced the problem described in your article, I decided to try using DefragSysoc.

However, apparently it did not run as after running HFSLIP the backup file created by DefragSysoc (SOURCESS\I386\SYSOCBAK.IN_) does not exist.

I created HFSLIP_POST_DefragSysoc.cmd (contains only the line below)

"%~dp0DefragSysoc.exe"

I left the double-quotes in place as shown in the example in the article linked to below, please advise if they should be removed.

I placed DefragSysoc.exe and the above .cmd file in the HFTOOLS folder

Then I ran hfslip-1.7.10_beta_G.cmd.

Should this utility work with this beta?

Your article says that DefragSysoc.exe does some error checking. Perhaps it doesn't like something. I followed your instructions. In case it might be helpful, I've attached some files for you to look at.

Any clues you might offer would be appreciated.

Thank you, Lilla

Sysoc.zip

Edited by Lilla
0

Share this post


Link to post
Share on other sites

The backup file created by DefragSysoc (SOURCESS\I386\SYSOCBAK.IN_) does not exist because in SOURCE\i386 folder, sysoc.in_ is still having 2 [Components] sections.

(SYSOC_2source_after.inf)

You should only have 1 edited sysoc.in_ in your SOURCE\i386 folder.

(SYSOC_1sourceEDITED_before.inf is preferred, just rename to sysoc.inf & compressed it to sysoc.in_)

How SYSOC_2source_after.inf comes about, I dun know. It should not be there.

DefragSysoc.exe only look for sysoc.in_ in SOURCESS\i386 to process. If you have more than 1 copy of sysoc.in? in SOURCE\i386, then maybe DefragSysoc.exe process the wrong sysoc.in_ (Not tested)

Remove all other duplicated sysoc.in? in SOURCE\i386 folder if any.

Then test again in VM or let me know what is the error message generated by DefragSysoc.exe

I created HFSLIP_POST_DefragSysoc.cmd (contains only the line below)

"%~dp0DefragSysoc.exe"

I left the double-quotes in place as shown in the example in the article linked to below, please advise if they should be removed.

The double quote should not be removed unless the file full path to DefragSysoc.exe does not contain space.

Hope that helps,

Kinds regards

0

Share this post


Link to post
Share on other sites

The backup file created by DefragSysoc (SOURCESS\I386\SYSOCBAK.IN_) does not exist because in SOURCE\i386 folder, sysoc.in_ is still having 2 [Components] sections.

(SYSOC_2source_after.inf)

You should only have 1 edited sysoc.in_ in your SOURCE\i386 folder.

(SYSOC_1sourceEDITED_before.inf is preferred, just rename to sysoc.inf & compressed it to sysoc.in_)

How SYSOC_2source_after.inf comes about, I dun know. It should not be there.

DefragSysoc.exe only look for sysoc.in_ in SOURCESS\i386 to process. If you have more than 1 copy of sysoc.in? in SOURCE\i386, then maybe DefragSysoc.exe process the wrong sysoc.in_ (Not tested)

Remove all other duplicated sysoc.in? in SOURCE\i386 folder if any.

Then test again in VM or let me know what is the error message generated by DefragSysoc.exe

I created HFSLIP_POST_DefragSysoc.cmd (contains only the line below)

"%~dp0DefragSysoc.exe"

I left the double-quotes in place as shown in the example in the article linked to below, please advise if they should be removed.

The double quote should not be removed unless the file full path to DefragSysoc.exe does not contain space.

Hope that helps,

Kinds regards

I know this is kind of hard to follow, but I did exactly as you instructed above and in your original post.

The problem seems to be with hfslip-1.7.10_beta_G.cmd. When I run it, it changes the edited version of \SOURCE\SYSOC.IN_ (that contains .INF) I put there (before running HFSLIP) so that it AGAIN has two components sections.

Is it perhaps a problem with beta G, is it changing \SOURCE\SYSOC.IN_ when it should be changing \SOURCESS\SYSOC.IN_ ? Have you tested using hfslip-1.7.10_beta_G.cmd?

Lilla

Edited by Lilla
0

Share this post


Link to post
Share on other sites

I have tested with hfslip-1.7.10_beta_G.cmd, works okay on my side. (But I will check more on my SOURCE\I386 when I get home.)

Let me know what is the error message generated by defragsysoc.exe when run with HFSLIP.

Also I notice in HFTOOLS folder, you have HFANSWER.INF. I have it as HFANSWER.INI (Nav to Guidelines->Extra; item2)

I dun know if there is any different. You might want to rename this.

0

Share this post


Link to post
Share on other sites

I have tested with hfslip-1.7.10_beta_G.cmd, works okay on my side. (But I will check more on my SOURCE\I386 when I get home.)

Let me know what is the error message generated by defragsysoc.exe when run with HFSLIP.

Where would this error message appear? There is nothing in HFSLIP.LOG (see SYSOC.ZIP in my earlier post). As stated above, after running HFSLIP...cmd to prepare the .iso, the \SOURCESS\I386 folder does not contain the backup file created by defragsysoc.exe, so it doesn't appear that it runs.

Due to the above, I did not create a CD and install from it. But, I will do so if you think this would provide any additional information to work with. Please advise.

Also I notice in HFTOOLS folder, you have HFANSWER.INF. I have it as HFANSWER.INI (Nav to Guidelines->Extra; item2)

I dun know if there is any different. You might want to rename this.

Done. I changed HFANSWER.INF to HFANSWER.INI - Thanks for letting me know.

Thank you for trying to help figure out what is happening (or not happening) here.

Lilla

0

Share this post


Link to post
Share on other sites

The error would only appear when DefragSysoc.exe is ran. It doesn't write to any log file.

Here is a way to manually simulate it.

Assuming on C:\ root, create a dummy folder call Dummy (i.e C:\Dummy)

In C:\Dummy, create HFTOOLS, SOURCE\I386 & SOURCESS\I368 folders

Put your Edited sysoc.IN_ in C:\Dummy\SOURCE\I386

Put DefragSysoc.exe in C:\Dummy\HFTOOLS

(You may wish to run a quick check in HFTOOLS. Just open in console box and run this command, DefragSysoc /check)

Put SYSOC_3sourcess_after.inf in C:\Dummy\SOURCESS\I368

Make sure SYSOC_3sourcess_after.inf is rename to SYSOC.inf. Then manually merge this line

[Components]
msnexplr=ocmsn.dll,OcEntry,msnmsn.inf,,7

to the main [Components]. Remove this [Components] string. So now you have 2 [Components] section.

Makecab to SYSOC.IN_. Then delete SYSOC.INF

Double click on DefragSysoc.exe to let it process.

After run, check the content of SYSOC.INF in your SOURCESS. You should be able to see SYSOCBAK.IN_ as well.

Normally When I run HFSLIP, I would let it create the iso as well. Ususally all these are unattended.

I still have no clue why HFSLIP is modifying your SOURCE. It doesn't modify mine in my case. Sorry to say that.

===== update DefragSysoc.exe to include quick check on SOURCE\I386\SYSOC.IN_

See 1st post for detail. Thanks

0

Share this post


Link to post
Share on other sites

Geej,

When I run HFSLIP I get the error message shown in the attachment. This is consistent with what I have been saying, that after running HFSLIP, the \SOURCE\SYSOC.IN_ file that I created (I combined the 2 components sections into 1) has been changed by HFSLIP to one with again 2 component sections. Thus, \SOURCESS\SYSOC.IN_ winds up having 3 components sections.

I didn't see this message earlier because I wasn't watching the screen. Perhaps it would be better if this message didn't clear automatically.

Since HFSLIP changes the \SOURCE\SYSOC.IN_ file on my system, I will have to give up on using DefragSysoc.exe, at least until/unless this can be resolved.

Thank you for your help,

Lilla

post-55669-126679491502_thumb.png

Edited by Lilla
0

Share this post


Link to post
Share on other sites

Hi Lilla

I have re-script to suit your situation. It's Defrag2Sysoc.exe. (The number 2 here means defrag with 2 [Components] sections in SOURCE.)

Script towards your given SYSOC_3sourcess_after.inf, meaning SYSOC.INF should have the following orders in your SOURCE:

[Version]
[Components]
[Global]
[Components] <--Location must be right after [Global] and before [Strings] sections
[Strings]

Hope that solve the problem.

Defrag2Sysoc.exe still support /check switch

- Add /nobackup switch if you want SYSOCBAK.IN_ to be deleted after run.

- Has also modify code to check SOURCE\I386 but still need user to visual inspect/edit the file.

Script will expand to inspect numbers of [Components] section,

Ask if user wish to open sysoc.inf using default notepad for viewing/editing

If yes, open file. After user save/modify/no modify the file, user close the file,

the script will makecab it to SYSOC.IN_ . Then finally delete sysoc.inf and exit script)

BTW, if there is any error, error message will not timeout.

Hence any user is able to use this alternative script if their SOURCE matches the above requrirement listed in the codebox.

Just modify HFSLIP_POST_Defrag2Sysoc.cmd to below code (or DL this simple cmd attachment to HFTOOLS folder)

"%~dp0Defrag2Sysoc.exe"

or

"%~dp0Defrag2Sysoc.exe" /nobackup

Edit 30-Apr-2010: Alternatve script removed as main script able to handles multiple [Components] sections

Edited by Geej
0

Share this post


Link to post
Share on other sites

Hi Lilla

I have re-script to suit your situation. It's Defrag2Sysoc.exe. (The number 2 here means defrag with 2 [Components] sections in SOURCE.)

Script towards your given SYSOC_3sourcess_after.inf, meaning SYSOC.INF should have the following orders in your SOURCE:

[Version]
[Components]
[Global]
[Components] <--Location must be right after [Global] and before [Strings] sections
[Strings]

Hope that solve the problem.

Good work! It solved the problem. It worked and it was so easy. All I had to do was to put Defrag2Sysoc.exe and HFSLIP_POST_Defrag2Sysoc.cmd in \TOOLS folder, and run HFSLIP (1.7.10 beta g)
Defrag2Sysoc.exe still support /check switch

- Has also modify code to check SOURCE\I386 but still need user to visual inspect/edit the file. Script will expand to inspect numbers of [Components] section, Ask if user wish to open sysoc.inf using default notepad for viewing/editing If yes, open file. After user save/modify/no modify the file, user close the file, the script will makecab it to SYSOC.IN_ . Then finally delete sysoc.inf and exit script) BTW, if there is any error, error message will not timeout.

As I understand it, the above would only happen if I used the /check switch, which I didn't do. I of course had already confirmed that I met the requirements (2 components sections; section names and order matching that given in first quote in this post). I did not edit anything. It didn't ask me anything, nothing opened up, no error message. All appears to have worked perfectly!

Hence any user is able to use this alternative script if their SOURCE matches the above requriement listed in the codebox.

Just modify HFSLIP_POST_DefragSysoc.cmd to

"%~dp0Defrag2Sysoc.exe"

Defrag2Sysoc.exe

Size: 305.74 Kb (313,073 bytes)

MD5: 396874C19549BAF007F8838B6F9FA3B6

I used the name HFSLIP_POST_Defrag2Sysoc.cmd (with the 2 in it for consistency with the name of the .exe).

FYI. Defrag2Sysoc.exe and HFSLIP_POST_Defrag2Sysoc.cmd are not detected as threats by...

- Microsoft Security Essentials (MSE) - antivirus +

- Spybot Search & Destroy

- MalwareBytes AntiMalware

I attached some files in case you (or others) want to check what happened here.

A summary of the files attached:

0 SYSOC.INF (in \SOURCE\SYSOC.IN_) before HFSLIP+Defrag2Sysoc.exe

Contents: 27 entries in 2 [Components] sections

1 SYSOC.INF (in \SOURCES\SYSOC.IN_) after HFSLIP+Defrag2Sysoc.exe

Contents: 32 entries in 2 [Components] sections

2 SYSOC.INF (in \SOURCESS\SYSOCBAK.IN_) after HFSLIP+Defrag2Sysoc.exe

A backup copy of SOURCESS\SYSOC.IN_ made by Defrag2Sysoc.exe before it makes any changes.

Contents: 35 entries in 3 [Components] sections.

2 SYSOC.INF (in \SOURCESS\SYSOC.IN_) after HFSLIP+Defrag2Sysoc.exe

This file contains the result of Defrag2Sysoc.exe, i.e. it defrags the components section.

Contents: 35 entries in 1 [Components] section; the components sections is defragged.

HFSLIP.LOG

---

Thank you so very much for getting this to work for me. I hope others will try it too.

Lilla

0_SYSOC_source_before_HFSLIP.zip

1_SYSOC_source_after_HFSLIP.zip

2_SYSOC_sourcess_after_HFSLIP.zip

HFSLIP.zip

Edited by Lilla
0

Share this post


Link to post
Share on other sites

Update the 2 scripts (in Post #1 & #9)

- Now writes from line 2 and add a blank line at end of file

B'cause it will look neater if there is a 'delete entry' operation to sysoc.inf such as program uninstall.

[Components] section will be moved down automatically by XP once there is a delete operation.

- Tidy up internal codes

- Add a switch /nobackup if you want SYSOCBAK.IN_ to be deleted in SOURCESS\I386 after run.

It will only be deleted if defragsysoc.exe or defrag2sysoc.exe completed successfully.

A small log (defragsysoc.log or defrag2sysoc.log) will be created in HFTOOLS, indicating it's status.

- To run with /nobackup, HFSLIP_POST_DefragSysoc.cmd or HFSLIP_POST_Defrag2Sysoc.cmd need to change to

"%~dp0DefragSysoc.exe" /nobackup
or
"%~dp0Defrag2Sysoc.exe" /nobackup

:)

0

Share this post


Link to post
Share on other sites

Update the 2 scripts (in Post #1 & #9)

- Now writes from line 2 and add a blank line at end of file

B'cause it will look neater if there is a 'delete entry' operation to sysoc.inf such as program uninstall.

[Components] section will be moved down automatically by XP once there is a delete operation.

- Tidy up internal codes

- Add a switch /nobackup if you want SYSOCBAK.IN_ to be deleted in SOURCESS\I386 after run.

It will only be deleted if defragsysoc.exe or defrag2sysoc.exe completed successfully.

A small log (defragsysoc.log or defrag2sysoc.log) will be created in HFTOOLS, indicating it's status.

- To run with /nobackup, HFSLIP_POST_DefragSysoc.cmd or HFSLIP_POST_Defrag2Sysoc.cmd need to change to

"%~dp0DefragSysoc.exe" /nobackup
or
"%~dp0Defrag2Sysoc.exe" /nobackup

:)

Very nice!

I think this is a subtle problem that most are not aware of. It is amazing that you understand it and developed a solution. It would be a shame if your valuable work gets lost by rolling to the back pages of this forum. To preserve your work, it would be helpful to the HFSLIP community, if this issue and your solution could be documented on tommyp's HFSLIP.org page, and included on mimo's update list with perhaps a link to this thread.

Lilla

Edited by Lilla
0

Share this post


Link to post
Share on other sites

Should this functionality be included in HFSLIP itself and always run, or do I not understand the purpose and usefulness of this script? Could anything bad happen if this is always run after every use of HFSLIP? Why would you not want to run it and defrag sysoc.inf?

Cheers and Regards

0

Share this post


Link to post
Share on other sites

Should this functionality be included in HFSLIP itself and always run, or do I not understand the purpose and usefulness of this script? Could anything bad happen if this is always run after every use of HFSLIP? Why would you not want to run it and defrag sysoc.inf?

Yes, that's what I'm asking me also. Sorry smile.gif

I support Lilla's idea to put a link it to the XP-list. It sounds interesting but when reading there are so much "if this.. if that... ensure this... check that...". smile.gif For a "normal user" who is not editing inf's manually (like me biggrin.gif ), is there an easy way? Like "just download it"? Any disadvantages?

Appears the problem of a fragmented file only for deinstalling windows-components which are installed by default?

Edited by Mim0
0

Share this post


Link to post
Share on other sites

Should this functionality be included in HFSLIP itself and always run, or do I not understand the purpose and usefulness of this script? Could anything bad happen if this is always run after every use of HFSLIP? Why would you not want to run it and defrag sysoc.inf?

Yes, that's what I'm asking me also. Sorry smile.gif

I support Lilla's idea to put a link it to the XP-list. It sounds interesting but when reading there are so much "if this.. if that... ensure this... check that...". smile.gif For a "normal user" who is not editing inf's manually (like me biggrin.gif ), is there an easy way? Like "just download it"? Any disadvantages?

Appears the problem of a fragmented file only for deinstalling windows-components which are installed by default?

Geej, regarding an easy way, some thoughts/questions...

Consider, as part of the "easy way" perhaps you could...

o add HFSLIP_POST_DefragSysoc.cmd (with the one line command in it) to post #1

o add HFSLIP_POST_Defrag2Sysoc.cmd (with the one line command in it) to post #9

While it's easy to make these .cmd files, it's not as easy as clicking a download link. Also, a novice user could make a mistake when creating this file.

Now, in thinking about a possible "easy way", as I understand it...

o DefragSysoc.exe will abort if Sysoc.ini (in Source\Sysoc.in_) contains more or less than 1 components section, or if sections are not in expected order.

o Defrag2Sysoc.exe will abort if Sysoc.ini (in Source\Sysoc.in_) contains more or less than than 2 components, or if sections are not in expected order.

Which makes me wonder if something like this would work.

Simply place all four files (shown below) in HFTOOLS and let both run as they will abort if not needed.

- DefragSysoc.exe and HFSLIP_POST_DefragSysoc.cmd

- Defrag2Sysoc.exe and HFSLIP_POST_Defrag2Sysoc.cmd

In the future, consider (if it makes sense to you) combining DefragSysoc.exe and Defrag2Sysoc.exe, with a branch to the correct logic. Then users would only have to download two files (.exe and .cmd file). Just a thought.

Lilla

Edited by Lilla
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.