I have a funny problem:
A program I've written uses a DLL. When installed, both the program exe and the DLL are under c:\Program Files (x86)\MyProduct
Normally the loaded DLL is a 3rd party driver. For testing purposes I replaced it with my own implementation. When I overwrite the 3rd party DLL with my own in the program files folder my program EXE cannot start the DLL, LoadLibraray returns 0 and GetLastError returns -529697949. Now when I copy the whole MyProduct folder to, let's say c:\temp and start the program EXE the DLL can be loaded.
So I guess my problem is related to Windows security. Both the programm and my version of the DLL are written in C++. My user accoount has Administrator access and it does not seem to matter if I execute the program as Administrator or not. Does anybody know if there is a windows protection mechanism that might prevent that the DLL is loaded?
Thank you
Update
I think the problem is related to the fact that my DLL tries to write to the execution directory in the DLL init function. When executing in Program Files directory windows does not allow this.
Yes, I finally got it running. The problem is that my DLL tried to write to the exe folder during DLL initialization. Windows seems to detect this and the LoadLibrary call fails.