### Author Topic: Known DLLs  (Read 1575 times)

#### jj2007

• Member
• Posts: 7558
• Assembler is fun ;-)
##### Known DLLs
« on: September 25, 2016, 07:18:30 PM »
Init
GetRegArray "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\KnownDLLs", Dll\$(), Name\$()      ; the optional second array takes the values
QSort Name\$()
For_ ecx=0 To eax-1      ; skip the 2 folder names
PrintLine Str\$(ecx+1), Tb\$, Name\$(ecx)
Next
Inkey
EndOfCode

Output Win XP:
Code: [Select]
`1       %SystemRoot%\system322       advapi32.dll3       comdlg32.dll4       gdi32.dll5       imagehlp.dll6       kernel32.dll7       lz32.dll8       ole32.dll9       oleaut32.dll10      olecli32.dll11      olecnv32.dll12      olesvr32.dll13      olethk32.dll14      rpcrt4.dll15      shell32.dll16      url.dll17      urlmon.dll18      user32.dll19      version.dll20      wininet.dll21      wldap32.dll`
Output Win7-64:
Code: [Select]
`1       %SystemRoot%\system322       %SystemRoot%\syswow643       advapi32.dll4       clbcatq.dll5       COMDLG32.dll6       difxapi.dll7       gdi32.dll8       IERTUTIL.dll9       IMAGEHLP.dll10      IMM32.dll11      kernel32.dll12      LPK.dll13      MSCTF.dll14      MSVCRT.dll15      NORMALIZ.dll16      NSI.dll17      ole32.dll18      OLEAUT32.dll19      PSAPI.DLL20      rpcrt4.dll21      sechost.dll22      Setupapi.dll23      SHELL32.dll24      SHLWAPI.dll25      URLMON.dll26      user32.dll27      USP10.dll28      WININET.dll29      WLDAP32.dll30      WS2_32.dll`
Output Win10:
Code: [Select]
`1       advapi32.dll2       clbcatq.dll3       combase.dll4       COMDLG32.dll5       coml2.dll6       difxapi.dll7       gdi32.dll8       gdiplus.dll9       IMAGEHLP.dll10      IMM32.dll11      kernel32.dll12      LPK.dll13      MSCTF.dll14      MSVCRT.dll15      NORMALIZ.dll16      NSI.dll17      ole32.dll18      OLEAUT32.dll19      PSAPI.DLL20      rpcrt4.dll21      sechost.dll22      Setupapi.dll23      SHELL32.dll24      SHLWAPI.dll25      user32.dll26      WLDAP32.dll27      Wow64.dll28      Wow64cpu.dll29      Wow64win.dll30      WS2_32.dll`
Some more (exe attached)?

Question: What is missing in the recent OS versions' lists above? Has anybody ever used a DLL that is NOT in the list?

#### sinsi

• Member
• Posts: 996
##### Re: Known DLLs
« Reply #1 on: September 25, 2016, 11:21:36 PM »
Not sure what you're getting at here, KnownDlls is a hint to the loader to short-circuit the usual dll search pattern.

>Has anybody ever used a DLL that is NOT in the list?
Plenty. unrar.dll, nvapi.dll
I can walk on water but stagger on beer.

#### jj2007

• Member
• Posts: 7558
• Assembler is fun ;-)
##### Re: Known DLLs
« Reply #2 on: September 26, 2016, 03:01:13 AM »
KnownDlls is a hint to the loader to short-circuit the usual dll search pattern.

Yes, with possibly nasty consequences (Raymond Chen):
Quote
There was one program that had a file called Version.dll in the application directory. Under normal rules, this private copy of Version.dll would override the one in the system directory, but in Windows XP, Version.dll is listed as a known DLL. This means that the copy in the application directory is ignored and the version in the system directory wins.

Quote
>Has anybody ever used a DLL that is NOT in the list?
Plenty. unrar.dll, nvapi.dll

I meant DLLs that are part of Windows, and would typically appear in \Masm32\include

The question here is if we really need to cover all the crap that Microsoft has added over the years. 95% of all the includes listed will never be used in a "normal" project. If we could use the Known DLLs as a "core library", the occasionally missing PROTO could easily be added to the beginning of the source...

Look at these behemoths of VS - I have lost 12 GB of disk space so far. The whole Masm32 folder is less than 0.3% of that

#### MichaelW

• Global Moderator
• Member
• Posts: 1209
##### Re: Known DLLs
« Reply #3 on: September 26, 2016, 05:46:38 AM »
ComCtl32.dll?
Well Microsoft, here’s another nice mess you’ve gotten us into.

#### jj2007

• Member
• Posts: 7558
• Assembler is fun ;-)
##### Re: Known DLLs
« Reply #4 on: September 26, 2016, 06:03:03 AM »
ComCtl32.dll?

Good point

\Masm32\include\masm32rt.inc
Code: [Select]
`    ; -------------------------    ; Windows API include files    ; -------------------------      include \masm32\include\gdi32.inc      include \masm32\include\user32.inc      include \masm32\include\kernel32.inc      include \masm32\include\Comctl32.inc      include \masm32\include\comdlg32.inc      include \masm32\include\shell32.inc      include \masm32\include\oleaut32.inc      include \masm32\include\ole32.inc      include \masm32\include\msvcrt.inc`

#### TWell

• Member
• Posts: 748
##### Re: Known DLLs
« Reply #5 on: September 26, 2016, 06:38:11 AM »
ComCtl32.dll is version dependent?

#### jj2007

• Member
• Posts: 7558
• Assembler is fun ;-)
##### Re: Known DLLs
« Reply #6 on: September 26, 2016, 07:08:01 AM »
ComCtl32.dll is version dependent?

InitCommonControls is present in all Windows versions since '95.

Or did you mean something else?

#### hutch--

• Member
• Posts: 4813
• Mnemonic Driven API Grinder
##### Re: Known DLLs
« Reply #7 on: September 26, 2016, 09:34:42 AM »
On anything after win98se you really need to InitCommonControlsEx with the structure so that you can use a wider range of common controls.
hutch at movsd dot com
http://www.masm32.com

#### jj2007

• Member
• Posts: 7558
• Assembler is fun ;-)
##### Re: Known DLLs
« Reply #8 on: September 26, 2016, 06:00:44 PM »
On anything after win98se you really need to InitCommonControlsEx with the structure so that you can use a wider range of common controls.

Sure. Question here is really why M\$ doesn't list it in the "known" dlls

#### TWell

• Member
• Posts: 748
##### Re: Known DLLs
« Reply #9 on: September 26, 2016, 08:18:25 PM »
Program can use version 5 or version 6 ComCtl32.dll and those are different dll's.
OS can't use same preload dll for it.
Those was IE stuff some time ago.

#### jj2007

• Member
• Posts: 7558
• Assembler is fun ;-)
##### Re: Known DLLs
« Reply #10 on: September 26, 2016, 11:22:16 PM »
Yes, that could be an explanation: You can't put it into the "known" list because an application that relies on an earlier version, and has it in the exe's folder, would get C:\Windows\System32\comctl32.dll instead. That implies, however, that the functionality has changed. Sounds messy...

A propos messy: Pairing libraries with header files
Quote
I know what .h, .dll, and .lib files do and how they work together. I say that because the question seems to be asked and answered frequently, and it's not my question. I need to know how to find out which library file goes with which .h file.

The answer is that there is no answer. The compiler knows somehow, but it's not documented anywhere.

#### hutch--

• Member
• Posts: 4813
• Mnemonic Driven API Grinder
##### Re: Known DLLs
« Reply #11 on: September 27, 2016, 12:31:14 AM »
> I need to know how to find out which library file goes with which .h file

This is an unsound assumption in that Microsoft header files have never matched their libraries. You can routinely get the name of imports from libraries with a simple search but the header files are all over the place and it would seem to be deliberate obfuscation.
hutch at movsd dot com
http://www.masm32.com

#### jj2007

• Member
• Posts: 7558
• Assembler is fun ;-)
##### Re: Known DLLs
« Reply #12 on: September 27, 2016, 02:02:02 AM »
it would seem to be deliberate obfuscation.

Indeed