; Module/File: System_DetectWine.pb ; Function: Detect if program is running under wine - Windows / Wine ; Author: _JON_, Omi ; Date: Jul. 27, 2017 ; Version: 0.1 ; Target Compiler: PureBasic 5.22/5.3/5.4/5.5/5.6 ; Target OS: Wine ; Link to topic: http://www.purebasic.fr/german/viewtopic.php?f=3&t=30239 ;-------------------------------------------------------------- PrototypeC wine_get_version() PrototypeC wine_get_build_id() Procedure Wine_IsDetected() Protected.i Ret= #False Protected hntdll= OpenLibrary(#PB_Any, "ntdll.dll") If hntdll If GetFunction(hntdll, "wine_get_version") Ret= #True EndIf CloseLibrary(hntdll) EndIf ProcedureReturn Ret EndProcedure Procedure.s Wine_GetVersion() Protected.s Ret Protected hntdll= OpenLibrary(#PB_Any, "ntdll.dll") If hntdll If GetFunction(hntdll, "wine_get_version") Protected Function.wine_get_version= GetFunction(hntdll, "wine_get_version") Ret= PeekS(Function(), -1, #PB_Ascii) EndIf CloseLibrary(hntdll) EndIf ProcedureReturn Ret EndProcedure Procedure.s Wine_GetBuildId() Protected.s Ret Protected hntdll= OpenLibrary(#PB_Any, "ntdll.dll") If hntdll If GetFunction(hntdll, "wine_get_build_id") Protected Function.wine_get_build_id= GetFunction(hntdll, "wine_get_build_id") Ret= PeekS(Function(), -1, #PB_Ascii) EndIf CloseLibrary(hntdll) EndIf ProcedureReturn Ret EndProcedure If Wine_IsDetected() Debug "Wine version: " + Wine_GetVersion() Debug Wine_GetBuildId() EndIf ; IDE Options = PureBasic 5.44 LTS (Linux - x86) ; CursorPosition = 9 ; Folding = - ; EnableUnicode ; EnableXP