GetModuleFileName() private method

private GetModuleFileName ( IntPtr hModule, StringBuilder strFullPath, int nSize ) : int
hModule System.IntPtr
strFullPath StringBuilder
nSize int
return int
Exemplo n.º 1
0
        private static bool CheckSteamAPIDLL()
        {
            string lpModuleName;
            int    num;

            if (IntPtr.Size == 4)
            {
                lpModuleName = "steam_api.dll";
                num          = 186560;
            }
            else
            {
                lpModuleName = "steam_api64.dll";
                num          = 206760;
            }
            IntPtr moduleHandle = DllCheck.GetModuleHandle(lpModuleName);
            bool   result;

            if (moduleHandle == IntPtr.Zero)
            {
                result = true;
            }
            else
            {
                StringBuilder stringBuilder = new StringBuilder(256);
                DllCheck.GetModuleFileName(moduleHandle, stringBuilder, stringBuilder.Capacity);
                string text = stringBuilder.ToString();
                if (File.Exists(text))
                {
                    FileInfo fileInfo = new FileInfo(text);
                    if (fileInfo.Length != (long)num)
                    {
                        return(false);
                    }
                    if (FileVersionInfo.GetVersionInfo(text).FileVersion != "02.89.45.04")
                    {
                        return(false);
                    }
                }
                result = true;
            }
            return(result);
        }