Author Topic: Known DLLs  (Read 1575 times)

jj2007

  • Member
  • *****
  • Posts: 7558
  • Assembler is fun ;-)
    • MasmBasic
Known DLLs
« on: September 25, 2016, 07:18:30 PM »
include \masm32\MasmBasic\MasmBasic.inc      ; download
  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%\system32
2       advapi32.dll
3       comdlg32.dll
4       gdi32.dll
5       imagehlp.dll
6       kernel32.dll
7       lz32.dll
8       ole32.dll
9       oleaut32.dll
10      olecli32.dll
11      olecnv32.dll
12      olesvr32.dll
13      olethk32.dll
14      rpcrt4.dll
15      shell32.dll
16      url.dll
17      urlmon.dll
18      user32.dll
19      version.dll
20      wininet.dll
21      wldap32.dll

Output Win7-64:
Code: [Select]
1       %SystemRoot%\system32
2       %SystemRoot%\syswow64
3       advapi32.dll
4       clbcatq.dll
5       COMDLG32.dll
6       difxapi.dll
7       gdi32.dll
8       IERTUTIL.dll
9       IMAGEHLP.dll
10      IMM32.dll
11      kernel32.dll
12      LPK.dll
13      MSCTF.dll
14      MSVCRT.dll
15      NORMALIZ.dll
16      NSI.dll
17      ole32.dll
18      OLEAUT32.dll
19      PSAPI.DLL
20      rpcrt4.dll
21      sechost.dll
22      Setupapi.dll
23      SHELL32.dll
24      SHLWAPI.dll
25      URLMON.dll
26      user32.dll
27      USP10.dll
28      WININET.dll
29      WLDAP32.dll
30      WS2_32.dll

Output Win10:
Code: [Select]
1       advapi32.dll
2       clbcatq.dll
3       combase.dll
4       COMDLG32.dll
5       coml2.dll
6       difxapi.dll
7       gdi32.dll
8       gdiplus.dll
9       IMAGEHLP.dll
10      IMM32.dll
11      kernel32.dll
12      LPK.dll
13      MSCTF.dll
14      MSVCRT.dll
15      NORMALIZ.dll
16      NSI.dll
17      ole32.dll
18      OLEAUT32.dll
19      PSAPI.DLL
20      rpcrt4.dll
21      sechost.dll
22      Setupapi.dll
23      SHELL32.dll
24      SHLWAPI.dll
25      user32.dll
26      WLDAP32.dll
27      Wow64.dll
28      Wow64cpu.dll
29      Wow64win.dll
30      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 ;-)
    • MasmBasic
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 8)

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 ;-)
    • MasmBasic
Re: Known DLLs
« Reply #4 on: September 26, 2016, 06:03:03 AM »
ComCtl32.dll?

Good point :t

\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 ;-)
    • MasmBasic
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--

  • Administrator
  • Member
  • ******
  • Posts: 4813
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
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    :biggrin:  :biggrin:

jj2007

  • Member
  • *****
  • Posts: 7558
  • Assembler is fun ;-)
    • MasmBasic
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 ;-)
    • MasmBasic
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--

  • Administrator
  • Member
  • ******
  • Posts: 4813
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
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    :biggrin:  :biggrin:

jj2007

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

Indeed :icon_mrgreen: