I am seeking to add functionality within a windows dll to detect the name of a calling Python script.
I am calling the dll via Python using ctypes as described in the answers to How can I call a DLL from a scripting language?
Within the dll I'm able to successfully determine the calling process using WINAPI GetModuleFileName() http://msdn.microsoft.com/en-us/library/windows/desktop/ms683197(v=vs.85).aspx. However, since this is a Python script it's being run via the Python executable thus the returned module file name is "C:/Python33/Python.exe". I'm needing the name of the actual script file doing the call. Is this possible?
A bit of background on why: this dll is used for authentication. It's generating a hash using a shared secret key for the script to use to authenticate an HTTP request. It's embedded in the dll so that people using the script won't see the key. We want to make sure the python file calling the script is signed so not just anyone can use this dll to generate a signature, so getting the filepath of the calling script is the first step.