WineVer.h 658 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. Simple header for detecting version of Wine
  3. */
  4. namespace WineVer
  5. {
  6. #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
  7. #include <windows.h>
  8. #include <string>
  9. #include <stdio.h>
  10. #pragma comment(lib, "advapi32")
  11. std::string getWineVer()
  12. {
  13. HMODULE hntdll = LoadLibraryW(L"ntdll.dll");
  14. if (hntdll == NULL)
  15. return "";
  16. char*(WINAPI * wine_get_version)() = (char*(WINAPI*)())GetProcAddress(hntdll, "wine_get_version");
  17. if (wine_get_version)
  18. {
  19. //puts("Wine detected.");
  20. //printf("Running on Wine... %s\n", wine_get_version());
  21. return std::string(wine_get_version());
  22. }
  23. return "";
  24. }
  25. }