.dll files

i have been working on a simple sample about SDL_image.h usage.

well then i wondered even though there r many .dll files used on windows. some of the .dll files needs to be in the same file with .exe instead of C:\Windows\System32. is it something about runtime and loadtime dlls or what?
Last edited on
closed account (9wqjE3v7)
DLLs only resolve symbols during runtime, meaning everything your .exe requests from a DLL is not 'linked' until your program asks for it. There only needs to be one DLL file, and all the windows DLLs like you've stated are in C:\Windows\System32 for security reasons.

Nothing from the DLL is actually part of the final EXE file, it is only loaded into memory, that is why DLLs need to be present at all times, whereas static libraries (.LIB) do not.

For example, if you install a program that needs the Advapi32.dll file from windows, you cannot move/delete Advapi32.dll since the program relies on that library every time it runs.

EDIT: Oops...did not read the question properly...ignore my answer
Last edited on
closed account (G309216C)
Hi,

The structure is due to DLL (Dynamic Link Libraries) files being loaded as you said for example few of DLL placement are due to privileges for example some of the locations such as C:\Windows\System32 need Administrator permission in order to copy themselves there, and when it is added there it will always run-as a administrator therefore it can be dangerous, for example a attacker may use the DLL to download and execute and copy a exe into System32 folder, which gives it Administrator privileges over the PC which presents a security risk.

That is why Windows prevents unauthorized entrance to locations. The Run-time is also affected by placement of DLL files for example if a DLL files is launched with its file location in System32 folder it will have Administrator Privileges and therefore it can execute in more privileged processes which allows it to execute higher privileged functions.

Finally anything in mentioned locations above are all auto-elevate flagged and will prevent other un-privileged files from copying themselves there.
If a un-privileged tries to edit a DLL in a privileged environment it will fail because of obvious security threats.
GL
Last edited on
The default order for DLL libraries loading is:
1. Exe Directory
2. SetDllDirectory Directory
3. System Directory
4. 16-bit System Directory
5. Windows Directory
6. PATH Directories

Source: http://msdn.microsoft.com/en-US/library/ms686203(v=vs.85).aspx
ty all for your answers and Montario79 it was informative so ty
Topic archived. No new replies allowed.