1

I want to create a dll that loads an ini file DLL_PROCESS_ATTACH. The is in the same directory as the executable loading the dll. Can this be done safely with respect to the loader lock?

regards Tobias

Tobias Langner
  • 10,634
  • 6
  • 46
  • 76

1 Answers1

1

According to Microsoft's best practices for DLLs, it is safe to open, read and write files.

Do's and don'ts reproduced in summary below

enter image description here

EDIT following on from your clarification in comments, yes it is safe to call GetModuleFileName because, as MSDN says (at the bottom of the page) that function is implemented in kernel32.dll (see above "safe" section).

Roger Rowland
  • 25,885
  • 11
  • 72
  • 113
  • the question is more: is it safe to get the directory where the application is located. And which way is safe? Can I call "GetModuleFileName"? – Tobias Langner Jun 14 '13 at 13:03
  • @TobiasLangner yes you can call `GetModuleFileName` because it's in `kernel32.dll` (in the "safe" section above). – Roger Rowland Jun 14 '13 at 13:08