- /* Build the path to the configuration file */
- Length = GetWindowsDirectoryW(ConfigFile, MAX_PATH);
+ /* Build the path to the configuration file from the application's path */
+ GetModuleFileNameW(NULL, ConfigFile, MAX_PATH);
+ Length = wcsrchr(ConfigFile, '\\') - ConfigFile;