
[Ulitily] Simplifinf, a basic inf simplifier (v0.30b)
-
- Posts: 210
- Joined: Tue Dec 13, 2005 12:52 pm
- Location: The Netherlands (But running US WinXP, in case it comes up)
hehe, sure is. I've still got some big plans for this, although I dunno how many I'll be able to realise. I really ought to write a proper FileHandler class based on Win32 API calls, as well. (and add Unicode support) Hmm, I was wondering, are there any other things I could do to inf files to make them more readable? What do you all think?
-
- Posts: 210
- Joined: Tue Dec 13, 2005 12:52 pm
- Location: The Netherlands (But running US WinXP, in case it comes up)
Talk about jumping in the deep end. Okay kids, don't expect to see Win32 API stuff anytime soon, as I'll have to research transacted IO and security descriptors and write some sort of lib so I can use it without losing it. (but what do you care, it's not like you'll notice a difference from the way Simplifinf currently works) Unicode support may come sooner, but first up is configuration support. That should be simple, but I've yet to figure out a good system for switches. I'm considering offering two options:
1.) switches in the form of +f1, +f2 to +fn and -f1, -f2 to -fn for respectively enabling and disabling the various filters.
2.) a bitmask switch in the form of -b[32-bit hexadecimal number] (for instance -b00000012 to enable filters 2 and 5) that does the same thing.
Thoughts?
1.) switches in the form of +f1, +f2 to +fn and -f1, -f2 to -fn for respectively enabling and disabling the various filters.
2.) a bitmask switch in the form of -b[32-bit hexadecimal number] (for instance -b00000012 to enable filters 2 and 5) that does the same thing.
Thoughts?
-
- Posts: 506
- Joined: Sun Feb 26, 2006 4:13 am
-
- Posts: 210
- Joined: Tue Dec 13, 2005 12:52 pm
- Location: The Netherlands (But running US WinXP, in case it comes up)
-
- Posts: 210
- Joined: Tue Dec 13, 2005 12:52 pm
- Location: The Netherlands (But running US WinXP, in case it comes up)
I'm bored, so here's a sneak peak of code for a filter I'm working on:
Here, S is a line in an inf file and A is the first position of an unquoted assignment character on that line..
So my question to you: what is B to S? (and no, the answer isn't BS
)
Edit: oh dear, two corrections needed. My apologies.
Code: Select all
if((B = S->substr(0,S->find_last_not_of(" \t",A-1)+1)).size() > A) continue;
B = B.substr(B.find_first_not_of(" \t"));
So my question to you: what is B to S? (and no, the answer isn't BS

Edit: oh dear, two corrections needed. My apologies.
Last edited by Mitsuko Aninikkou on Tue Sep 25, 2007 4:39 pm, edited 2 times in total.
B is the substring of S that contains the INF key value...
However if I get this correctly... if A is the position of the first char in the value, wouldn't considering (A-1) to be the position of the "=" unreliable...
Again if I get this correctly, this code belongs in a loop that processes the INF line by line and adding it to a buffer allocated outside the loop and continues if it meets certain filters...
The first line seems to check for INF key values that contain many "=" (ie: Invalid) and the second checks for empty keys ?
However if I get this correctly... if A is the position of the first char in the value, wouldn't considering (A-1) to be the position of the "=" unreliable...
Again if I get this correctly, this code belongs in a loop that processes the INF line by line and adding it to a buffer allocated outside the loop and continues if it meets certain filters...
The first line seems to check for INF key values that contain many "=" (ie: Invalid) and the second checks for empty keys ?
-
- Posts: 210
- Joined: Tue Dec 13, 2005 12:52 pm
- Location: The Netherlands (But running US WinXP, in case it comes up)
Well, as it happens string::npos, which is what the second argument of string::find_last_not_of() defaults to and makes it check from the end of the string, is equal to -1 by definition. So in the edge case that = is the first character on the line, it'll check the whole line. And since in this case the size of the substring will always be more than A == 0 (as it will always atleast contain =), the loop will go to the next iteration. If no characters are found other than spaces or tabs, the whole string will be used, but as this is also more than A it has the same result. What the first line does is get the largest substring of S that doesn't end in a tab character or a space, and assign it to B.
I see now that the second line is incorrect, so give me a moment to fix it.
Edit: fixed. I also removed the conditional, as it wasn't necessary (the first line returns if the substring is empty, and the substring obtained in the second line can't be empty since it would run into one of the characters found the first time). The second line gets the largest substring of B that doesn't start with a space or a tab and assigns it to B.
So in the end you're left with a string that has no whitespace before or after it, and which is the left-hand side of the assignment. This is assuming that the code isn't run unless the line contains an assignment symbol, but that's easy enough to ensure.
Of course, what I need that for is another question altogether..
I see now that the second line is incorrect, so give me a moment to fix it.
Edit: fixed. I also removed the conditional, as it wasn't necessary (the first line returns if the substring is empty, and the substring obtained in the second line can't be empty since it would run into one of the characters found the first time). The second line gets the largest substring of B that doesn't start with a space or a tab and assigns it to B.
So in the end you're left with a string that has no whitespace before or after it, and which is the left-hand side of the assignment. This is assuming that the code isn't run unless the line contains an assignment symbol, but that's easy enough to ensure.
Of course, what I need that for is another question altogether..
-
- Posts: 210
- Joined: Tue Dec 13, 2005 12:52 pm
- Location: The Netherlands (But running US WinXP, in case it comes up)
Strings sections are good - we all know this: they can save a lot of clutter and clarify things like GUIDs. However, unfortunately many manufacturers use them far too much, which can make the inf very hard to read, and a terrible pain to simplify.
For this reason, starting from the next version, which will also add configuration support through switches, Simplifinf shall contain a Strings section filter. This filter replaces every use of %[key]% strings with their corresponding value. The strings are then removed from the strings section. This filter tries to make sure strings that need them will still have quotes around them, while strings that don't have them removed to prevent syntax errors. It should also work independently of all other filters (although this is not recommended)
PS: yes, that's what the code was needed for.
For this reason, starting from the next version, which will also add configuration support through switches, Simplifinf shall contain a Strings section filter. This filter replaces every use of %[key]% strings with their corresponding value. The strings are then removed from the strings section. This filter tries to make sure strings that need them will still have quotes around them, while strings that don't have them removed to prevent syntax errors. It should also work independently of all other filters (although this is not recommended)
PS: yes, that's what the code was needed for.
their is a good lead from code65536 signiture/runtimes/ regarding Uniscribe
and their may be some helpful info in getting around those char code ,Unicode files after all
http://msdn.microsoft.com/library/defau ... b_35k5.asp
and their may be some helpful info in getting around those char code ,Unicode files after all

http://msdn.microsoft.com/library/defau ... b_35k5.asp
-
- Posts: 210
- Joined: Tue Dec 13, 2005 12:52 pm
- Location: The Netherlands (But running US WinXP, in case it comes up)
New version has been delayed by atleast a day. Mrs Peel asked me about a problem with one of her addons that she couldn't solve, and unfortunately it turned out to be a bitch to solve (long story short, it can't be done just using an inf file, so I had to add a cmd file) and had me busy all day. Have an exam coming up now, so I may not be able to update this for a few days.
- Kelsenellenelvian
- Moderator
- Posts: 4383
- Joined: Tue Nov 30, 2004 8:32 pm
- Location: Pocatello, ID
- Contact:
there is something %NT% doesn't like about it, i may be the only one having this error signature pop each time it is run.
blah blah blah
and there are still some problems using it through console ...naming related mainly
Code: Select all
AppName: simplifinf.exe AppVer: 0.0.0.0 ModName: simplifinf.exe
ModVer: 0.0.0.0 Offset: 00005e99
and there are still some problems using it through console ...naming related mainly
-
- Posts: 210
- Joined: Tue Dec 13, 2005 12:52 pm
- Location: The Netherlands (But running US WinXP, in case it comes up)
- UtCollector
- Posts: 464
- Joined: Sun Apr 09, 2006 8:31 pm
- Contact: