Added is_library_file() function.

This commit is contained in:
LoRd_MuldeR 2016-05-08 19:24:09 +02:00
parent 1087c599e8
commit 7f1bad6ca1
2 changed files with 14 additions and 1 deletions

View File

@ -140,8 +140,9 @@ namespace MUtils
//Sleep //Sleep
MUTILS_API void sleep_ms(const size_t &duration); MUTILS_API void sleep_ms(const size_t &duration);
//Is executable file? //Is executable/library file?
MUTILS_API bool is_executable_file(const QString &path); MUTILS_API bool is_executable_file(const QString &path);
MUTILS_API bool is_library_file(const QString &path);
//Shutdown & Hibernation //Shutdown & Hibernation
MUTILS_API bool is_hibernation_supported(void); MUTILS_API bool is_hibernation_supported(void);

View File

@ -1011,6 +1011,18 @@ bool MUtils::OS::is_executable_file(const QString &path)
return bIsExecutable; return bIsExecutable;
} }
bool MUtils::OS::is_library_file(const QString &path)
{
bool bIsLibrary = false;
const HMODULE hMod = LoadLibraryEx(MUTILS_WCHR(QDir::toNativeSeparators(path)), NULL, LOAD_LIBRARY_AS_IMAGE_RESOURCE);
if (hMod)
{
bIsLibrary = true;
FreeLibrary(hMod);
}
return bIsLibrary;
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// HIBERNATION / SHUTDOWN // HIBERNATION / SHUTDOWN
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////