Hello @Rohan Pande ,
To see how the OS handles this scenario, I set up a minimal test environment. I compiled a shared library, explicitly assigned it a .xyz extension, and attempted to load it from a minimal launcher executable using ::LoadLibraryExW(L"mylib.xyz", NULL, 0).
My observation during this test was that the application successfully mapped the module into memory and executed exported functions without any issues, as you can see in the screenshot of my local run below:
This outcome suggests that the Windows loader does not strictly enforce the .dll extension for a module to be recognized and loaded correctly.
Reading through the official documentation, this behavior appears to align with how the underlying APIs are designed:
- In the LoadLibraryExW documentation, the details regarding the
lpLibFileNameparameter indicate that the function appends the default.dllextension only if the file name extension is omitted entirely. This implies that.dllacts as a convenience fallback rather than a mandatory requirement. - Furthermore, according to the PE Format specification, Windows identifies a module's nature through internal binary structures. The PE loader checks for the
IMAGE_FILE_DLL(0x2000) characteristic flag within the COFF File Header to confirm that an image is a dynamic-link library, rather than relying on the file name suffix at the memory-mapping level.
Regarding your question about edge cases, while the operating system APIs seem to natively support custom extensions, you might potentially run into scenarios where third-party antivirus software, endpoint protection, or AppLocker policies flag executable code that resides inside files with unrecognized extensions. Testing your launcher and custom libraries against common security tools might be a good idea to ensure they do not cause false positives in a production environment.
Hope this provides some helpful context for your project. If you found my response helpful or informative, I would greatly appreciate it if you could follow this guide for your confirmation.
Thank you.