I've begun cross referencing the windows dlls in a 'map' format as Dan Kegel suggested. I'm not finished yet because it seems when I sort alphabetically I am sorting the entire path. Sample output is here: http://home.ptd.net/~compsol/winxp_sample_map.html Be aware though this HTML is around 900K. If anyone has comments or suggestions on how to improve it or the next logical step please let me know.
On February 3, 2003 09:18 pm, Dave Miller wrote:
If anyone has comments or suggestions on how to improve it or the next logical step please let me know.
Sure, here are my suggestions (in order of importance): 1. Transform the output to a matrix (a square matrix, a DLL per row & column, the entry at row r and column c gets an X if the DLL on row r imports the DLL in column c. 2. Get rid of the path from the DLL filenames, it's useless, and it eats up space. That is, just say userenv.dll instead of c:\windows\system32/userenv.dll. 3. Get rid of the .dll extension for similar reasons. 4. Remove the columns from the matrix that have no X's. 5. Order columns by order of importance. That is, the ones with more X's come first.
Dimitrie O. Paun wrote:
- Remove the columns from the matrix that have no X's.
No X's mean noone is linking to it, and it links to noone. I would like to know of its existance, even if it is unlinked. Let's also not forget that some modules (lpk.dll, for example) are only linked to dynamically (due to circular dependancy from GDI32).
- Order columns by order of importance. That is, the ones with more X's come first.
No, order them by order of dependancy. I.e. - I want to know that if a DLL links to a DLL that is below it in the list, it is a circular dependancy. There is a standard matrix view that looks something like this:
ntdll advapi32 user32 kernel32 msvcrt advapi32
user32
kernel32 X X X
msvcrt X
X
Ordering should be done by the following criteria:
1. If A depends on B, but B does not depend on A, A must appear higher than B. 2. If rule 1 did not resolve relative order, and A has more modules dependant on it than B, A must appear higher. 3. If neither rules resolved the order, make it arbitrary.
These two criteria make sure that the matrix is triangle shaped unless there's a circular dependancy. Also, these rules make sure that modules that depend on other modules and are heavily linked to, such as kernel32, are higher up than modules that depend on no other modules and are not linked to, such as actxprxy.
If you want, I can write some perl to create such a table from the available information.
Shachar
Shachar Shemesh wrote:
Ordering should be done by the following criteria:
- If A depends on B, but B does not depend on A, A must appear higher than B.
- If rule 1 did not resolve relative order, and A has more modules dependant on it than B, A must appear higher.
- If neither rules resolved the order, make it arbitrary.
These two criteria make sure that the matrix is triangle shaped unless there's a circular dependancy. Also, these rules make sure that modules that depend on other modules and are heavily linked to, such as kernel32, are higher up than modules that depend on no other modules and are not linked to, such as actxprxy.
If you want, I can write some perl to create such a table from the available information.
Also, get rid of the dups. Here's an example:
# c:\windows\system32/rsaenh.dll imports: advapi32.dll advapi32.dll kernel32.dll kernel32.dll msvcrt.dll msvcrt.dll mswsock.dll ntdll.dll user32.dll user32.dll ws2_32.dll
- Dan
On February 4, 2003 02:02 am, Shachar Shemesh wrote:
Dimitrie O. Paun wrote:
- Remove the columns from the matrix that have no X's.
No X's mean noone is linking to it, and it links to noone. I would like to know of its existance, even if it is unlinked.
You know about it, it has a row in the matrix. I was suggesting about removing empty columns, they just clutter the screen.
- Order columns by order of importance. That is, the ones with more X's come first.
No, order them by order of dependancy. I.e. - I want to know that if a DLL links to a DLL that is below it in the list, it is a circular dependancy. There is a standard matrix view that looks something like this:
Agreed. I wanted to add this as 6., but I figured I'd bring it up after we get the first things done. But if you can do it, I'd love it! ;)
Dave Miller wrote:
I've begun cross referencing the windows dlls in a 'map' format as Dan Kegel suggested. I'm not finished yet because it seems when I sort alphabetically I am sorting the entire path. Sample output is here: http://home.ptd.net/~compsol/winxp_sample_map.html Be aware though this HTML is around 900K. If anyone has comments or suggestions on how to improve it or the next logical step please let me know.
Definitely strip the paths. (The suffix, too, for anything ending in .dll.)
It would probably be helpful to print out two numbers next to each line: the number of libs imported directly and indirectly by the named file. That would give some idea of "distance from the core". - Dan
Thanks to everyone for your comments. Stripping the path, extension, etc. seem simple enough. I'm only getting the path so dumpbin can find the dlls. It doesn't need to be in the output. I like the matrix idea. The HTML output seems too difficult to read. I am learning basic perl as I write this script so I will need to give some thought to how I'm going to do this and see if I can dig up some examples.
At 09:18 PM 2/3/2003 -0500, you wrote:
I've begun cross referencing the windows dlls in a 'map' format as Dan Kegel suggested. I'm not finished yet because it seems when I sort alphabetically I am sorting the entire path. Sample output is here: http://home.ptd.net/~compsol/winxp_sample_map.htmlhttp://home.ptd.net/~compsol/winxp_sample_map.html Be aware though this HTML is around 900K. If anyone has comments or suggestions on how to improve it or the next logical step please let me know.