Esempio n. 1
0
void __declspec(dllexport) IsDotNet30Installed(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra) {
	EXDLL_INIT();

	// The .NET Framework 3.0 is an add-in that installs
	// on top of the .NET Framework 2.0.  For this version
	// check, validate that both 2.0 and 3.0 are installed.
	pushstring((IsNetfx20Installed() && IsNetfx30Installed() && CheckNetfxVersionUsingMscoree(g_szNetfx20VersionString)) ? "true" : "false");
}
Esempio n. 2
0
void __declspec(dllexport) GetDotNet30ServicePack(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra) {
	EXDLL_INIT();

	int iNetfx30SPLevel = -1;
	bool bNetfx30Installed = (IsNetfx20Installed() && IsNetfx30Installed() && CheckNetfxVersionUsingMscoree(g_szNetfx20VersionString));
	TCHAR szMessage[MAX_PATH];
	TCHAR szOutputString[MAX_PATH*20];

	if (bNetfx30Installed)
	{
		iNetfx30SPLevel = GetNetfxSPLevel(g_szNetfx30SpRegKeyName, g_szNetfxStandardSPxRegValueName);

		if (iNetfx30SPLevel > 0)
			pushint(iNetfx30SPLevel);
		else
			pushint(-1);
	}
	else
	{
		pushint(-2);
	}
}
Esempio n. 3
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
    int nReturnVal;

    // Stage 1: Figure out the situation with the installation of .NET
    if (IsNetfx20Installed())
    {
        // .NET's already installed, our job is done!
        nReturnVal = 0;
    }
    else
    {
        const TCHAR* szNetfxInstallerFileName;
        const TCHAR* szNetfxDownloadUrl;

        WORD wCpu = GetProcessorArchitecture();

        switch (wCpu)
        {
            case PROCESSOR_ARCHITECTURE_INTEL:
                szNetfxInstallerFileName = g_szNetfx20x86InstallerFileName;
                szNetfxDownloadUrl = g_szNetfx20x86DownloadUrl;
                break;

            case PROCESSOR_ARCHITECTURE_AMD64:
                szNetfxInstallerFileName = g_szNetfx20x64InstallerFileName;
                szNetfxDownloadUrl = g_szNetfx20x64DownloadUrl;
                break;

            default:
                szNetfxInstallerFileName = NULL;
                szNetfxDownloadUrl = g_szNetfx20DispatchDownloadUrl;
                break;
        }

        // .NET 2.0 is not installed. But if we have the installer in front of us,
        // then try to install it!
        if (NULL != szNetfxInstallerFileName && FileExists(szNetfxInstallerFileName))
        {
            // First, tell the user what we're about to do.
            MessageBox(NULL, g_szNetfx20FoundText, g_szMessageBoxTitle, MB_OK | MB_ICONINFORMATION);

            // .NET installer is present, so let's try and install it
            DWORD dwResult = OurShellExecute(szNetfxInstallerFileName, NULL, true);

            switch (dwResult)
            {
                // Success
                case 0:    
                    nReturnVal = 0;
                    break;

                // Reboot required
                case 8192: 
                    MessageBox(NULL, g_szNetfxInstallRebootRequired, g_szMessageBoxTitle, 
                        MB_OK | MB_ICONINFORMATION);

                    nReturnVal = 1;
                    break;

                // They cancelled. No sense in putting up another error message.
                case 1602:
                    nReturnVal = 1;
                    break;

                // Other. Interpreted as failure.
                default:   
                    {
                        TCHAR szErrorText[1024];

                        HRESULT hr = StringCchPrintf(
                            szErrorText, 
                            sizeof(szErrorText) / sizeof(szErrorText[0]), 
                            g_szNetfxInstallFailureTextFormat,
                            dwResult,
                            dwResult);

                        if (SUCCEEDED(hr))
                        {
                            MessageBox(NULL, szErrorText, g_szMessageBoxTitle, MB_OK | MB_ICONERROR);
                        }
                    }

                    nReturnVal = 1;
                    break;
            }
        }
        else
        {
            // .NET not installed, and the installer isn't around. Ask them to go to a website in order to install it.
            int nResult = MessageBox(NULL, g_szNetfx20NotFoundText, g_szMessageBoxTitle, 
                MB_OKCANCEL | MB_ICONERROR);

            if (IDOK == nResult)
            {
                OurShellExecute(szNetfxDownloadUrl, NULL, false);
            }

            nReturnVal = 1;
        }
    }

    // Stage 2: Launch our setup app!
    if (0 == nReturnVal)
    {
        OurShellExecute(g_szPdnInstallerFileName, GetCommandLine(), true);
    }

    return nReturnVal;
}
Esempio n. 4
0
void __declspec(dllexport) IsDotNet20Installed(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop, extra_parameters *extra)
{
	EXDLL_INIT();
	pushstring((IsNetfx20Installed() && CheckNetfxVersionUsingMscoree(g_szNetfx20VersionString)) ? L"true" : L"false");
}
Esempio n. 5
0
CString DoDetectDotNet()
{
	int iNetfx10SPLevel = -1;
	int iNetfx11SPLevel = -1;
	int iNetfx20SPLevel = -1;
	int iNetfx30SPLevel = -1;
	int iNetfx35SPLevel = -1;
	int iNetfx40ClientSPLevel = -1;
	int iNetfx40FullSPLevel = -1;
	int iNetfx45SPLevel = -1;
	int iNetfx451SPLevel = -1;
	int iNetfx452SPLevel = -1;
	int iNetfx46SPLevel = -1;
	TCHAR szMessage[MAX_PATH];
	TCHAR szOutputString[MAX_PATH*20];

	// Determine whether or not the .NET Framework
	// 1.0, 1.1, 2.0, 3.0, 3.5, 4, 4.5, 4.5.1, 4.5.2, or 4.6 are installed
	bool bNetfx10Installed = (IsNetfx10Installed() && CheckNetfxVersionUsingMscoree(g_szNetfx10VersionString));
	bool bNetfx11Installed = (IsNetfx11Installed() && CheckNetfxVersionUsingMscoree(g_szNetfx11VersionString));
	bool bNetfx20Installed = (IsNetfx20Installed() && CheckNetfxVersionUsingMscoree(g_szNetfx20VersionString));

	// The .NET Framework 3.0 is an add-in that installs
	// on top of the .NET Framework 2.0.  For this version
	// check, validate that both 2.0 and 3.0 are installed.
	bool bNetfx30Installed = (IsNetfx20Installed() && IsNetfx30Installed() && CheckNetfxVersionUsingMscoree(g_szNetfx20VersionString));

	// The .NET Framework 3.5 is an add-in that installs
	// on top of the .NET Framework 2.0 and 3.0.  For this version
	// check, validate that 2.0, 3.0 and 3.5 are installed.
	bool bNetfx35Installed = (IsNetfx20Installed() && IsNetfx30Installed() && IsNetfx35Installed() && CheckNetfxVersionUsingMscoree(g_szNetfx20VersionString));

	bool bNetfx40ClientInstalled = (IsNetfx40ClientInstalled() && CheckNetfxVersionUsingMscoree(g_szNetfx40VersionString));
	bool bNetfx40FullInstalled = (IsNetfx40FullInstalled() && CheckNetfxVersionUsingMscoree(g_szNetfx40VersionString));

	// The .NET Framework 4.5, 4.5.1, 4.5.2, and 4.6 are in-place replacements for the .NET Framework 4.
	// They use the same runtime version as the .NET Framework 4.
	bool bNetfx45Installed = (IsNetfx45Installed() && CheckNetfxVersionUsingMscoree(g_szNetfx40VersionString));
	bool bNetfx451Installed = (IsNetfx451Installed() && CheckNetfxVersionUsingMscoree(g_szNetfx40VersionString));
	bool bNetfx452Installed = (IsNetfx452Installed() && CheckNetfxVersionUsingMscoree(g_szNetfx40VersionString));
	bool bNetfx46Installed = (IsNetfx46Installed() && CheckNetfxVersionUsingMscoree(g_szNetfx40VersionString));

	// If .NET Framework 1.0 is installed, get the
	// service pack level
	if (bNetfx10Installed)
	{
		iNetfx10SPLevel = GetNetfx10SPLevel();

		if (iNetfx10SPLevel > 0)
			_stprintf_s(szMessage, MAX_PATH, _T(".NET Framework 1.0 service pack %i is installed."), iNetfx10SPLevel);
		else
			_stprintf_s(szMessage, MAX_PATH, _T(".NET Framework 1.0 is installed with no service packs."));

		_tcscpy_s(szOutputString, szMessage);
	}
	else
	{
		_tcscpy_s(szOutputString, _T(".NET Framework 1.0 is not installed."));
	}

	// If .NET Framework 1.1 is installed, get the
	// service pack level
	if (bNetfx11Installed)
	{
		iNetfx11SPLevel = GetNetfxSPLevel(g_szNetfx11RegKeyName, g_szNetfxStandardSPxRegValueName);

		if (iNetfx11SPLevel > 0)
			_stprintf_s(szMessage, MAX_PATH, _T("\r\n.NET Framework 1.1 service pack %i is installed."), iNetfx11SPLevel);
		else
			_stprintf_s(szMessage, MAX_PATH, _T("\r\n.NET Framework 1.1 is installed with no service packs."));

		_tcscat_s(szOutputString, szMessage);
	}
	else
	{
		_tcscat_s(szOutputString, _T("\r\n.NET Framework 1.1 is not installed."));
	}

	// If .NET Framework 2.0 is installed, get the
	// service pack level
	if (bNetfx20Installed)
	{
		iNetfx20SPLevel = GetNetfxSPLevel(g_szNetfx20RegKeyName, g_szNetfxStandardSPxRegValueName);

		if (iNetfx20SPLevel > 0)
			_stprintf_s(szMessage, MAX_PATH, _T("\r\n.NET Framework 2.0 service pack %i is installed."), iNetfx20SPLevel);
		else
			_stprintf_s(szMessage, MAX_PATH, _T("\r\n.NET Framework 2.0 is installed with no service packs."));

		_tcscat_s(szOutputString, szMessage);
	}
	else
	{
		_tcscat_s(szOutputString, _T("\r\n.NET Framework 2.0 is not installed."));
	}

	// If .NET Framework 3.0 is installed, get the
	// service pack level
	if (bNetfx30Installed)
	{
		iNetfx30SPLevel = GetNetfxSPLevel(g_szNetfx30SpRegKeyName, g_szNetfxStandardSPxRegValueName);

		if (iNetfx30SPLevel > 0)
			_stprintf_s(szMessage, MAX_PATH, _T("\r\n.NET Framework 3.0 service pack %i is installed."), iNetfx30SPLevel);
		else
			_stprintf_s(szMessage, MAX_PATH, _T("\r\n.NET Framework 3.0 is installed with no service packs."));

		_tcscat_s(szOutputString, szMessage);
	}
	else
	{
		_tcscat_s(szOutputString, _T("\r\n.NET Framework 3.0 is not installed."));
	}

	// If .NET Framework 3.5 is installed, get the
	// service pack level
	if (bNetfx35Installed)
	{
		iNetfx35SPLevel = GetNetfxSPLevel(g_szNetfx35RegKeyName, g_szNetfxStandardSPxRegValueName);

		if (iNetfx35SPLevel > 0)
			_stprintf_s(szMessage, MAX_PATH, _T("\r\n.NET Framework 3.5 service pack %i is installed."), iNetfx35SPLevel);
		else
			_stprintf_s(szMessage, MAX_PATH, _T("\r\n.NET Framework 3.5 is installed with no service packs."));

		_tcscat_s(szOutputString, szMessage);
	}
	else
	{
		_tcscat_s(szOutputString, _T("\r\n.NET Framework 3.5 is not installed."));
	}

	// If .NET Framework 4 Client is installed, get the
	// service pack level
	if (bNetfx40ClientInstalled)
	{
		iNetfx40ClientSPLevel = GetNetfxSPLevel(g_szNetfx40ClientRegKeyName, g_szNetfx40SPxRegValueName);

		if (iNetfx40ClientSPLevel > 0)
			_stprintf_s(szMessage, MAX_PATH, _T("\r\n.NET Framework 4 client service pack %i is installed."), iNetfx40ClientSPLevel);
		else
			_stprintf_s(szMessage, MAX_PATH, _T("\r\n.NET Framework 4 client is installed with no service packs."));

		_tcscat_s(szOutputString, szMessage);
	}
	else
	{
		_tcscat_s(szOutputString, _T("\r\n.NET Framework 4 client is not installed."));
	}

	// If .NET Framework 4 Full is installed, get the
	// service pack level
	if (bNetfx40FullInstalled)
	{
		iNetfx40FullSPLevel = GetNetfxSPLevel(g_szNetfx40FullRegKeyName, g_szNetfx40SPxRegValueName);

		if (iNetfx40FullSPLevel > 0)
			_stprintf_s(szMessage, MAX_PATH, _T("\r\n.NET Framework 4 full service pack %i is installed."), iNetfx40FullSPLevel);
		else
			_stprintf_s(szMessage, MAX_PATH, _T("\r\n.NET Framework 4 full is installed with no service packs."));

		_tcscat_s(szOutputString, szMessage);
	}
	else
	{
		_tcscat_s(szOutputString, _T("\r\n.NET Framework 4 full is not installed."));
	}

	// If .NET Framework 4.5 is installed, get the
	// service pack level
	if (bNetfx45Installed)
	{
		iNetfx45SPLevel = GetNetfxSPLevel(g_szNetfx45RegKeyName, g_szNetfx40SPxRegValueName);

		if (iNetfx45SPLevel > 0)
			_stprintf_s(szMessage, MAX_PATH, _T("\r\n.NET Framework 4.5 service pack %i is installed."), iNetfx45SPLevel);
		else
			_stprintf_s(szMessage, MAX_PATH, _T("\r\n.NET Framework 4.5 is installed with no service packs."));

		_tcscat_s(szOutputString, szMessage);
	}
	else
	{
		_tcscat_s(szOutputString, _T("\r\n.NET Framework 4.5 is not installed."));
	}

	// If .NET Framework 4.5.1 is installed, get the
	// service pack level
	if (bNetfx451Installed)
	{
		iNetfx451SPLevel = GetNetfxSPLevel(g_szNetfx45RegKeyName, g_szNetfx40SPxRegValueName);

		if (iNetfx451SPLevel > 0)
			_stprintf_s(szMessage, MAX_PATH, _T("\r\n.NET Framework 4.5.1 service pack %i is installed."), iNetfx451SPLevel);
		else
			_stprintf_s(szMessage, MAX_PATH, _T("\r\n.NET Framework 4.5.1 is installed with no service packs."));

		_tcscat_s(szOutputString, szMessage);
	}
	else
	{
		_tcscat_s(szOutputString, _T("\r\n.NET Framework 4.5.1 is not installed."));
	}

	// If .NET Framework 4.5.2 is installed, get the
	// service pack level
	if (bNetfx452Installed)
	{
		iNetfx452SPLevel = GetNetfxSPLevel(g_szNetfx45RegKeyName, g_szNetfx40SPxRegValueName);

		if (iNetfx452SPLevel > 0)
			_stprintf_s(szMessage, MAX_PATH, _T("\r\n.NET Framework 4.5.2 service pack %i is installed."), iNetfx452SPLevel);
		else
			_stprintf_s(szMessage, MAX_PATH, _T("\r\n.NET Framework 4.5.2 is installed with no service packs."));

		_tcscat_s(szOutputString, szMessage);
	}
	else
	{
		_tcscat_s(szOutputString, _T("\r\n.NET Framework 4.5.2 is not installed."));
	}

	// If .NET Framework 4.6 is installed, get the
	// service pack level
	if (bNetfx46Installed)
	{
		iNetfx46SPLevel = GetNetfxSPLevel(g_szNetfx45RegKeyName, g_szNetfx40SPxRegValueName);

		if (iNetfx46SPLevel > 0)
			_stprintf_s(szMessage, MAX_PATH, _T("\r\n.NET Framework 4.6 service pack %i is installed."), iNetfx46SPLevel);
		else
			_stprintf_s(szMessage, MAX_PATH, _T("\r\n.NET Framework 4.6 is installed with no service packs."));

		_tcscat_s(szOutputString, szMessage);
	}
	else
	{
		_tcscat_s(szOutputString, _T("\r\n.NET Framework 4.6 is not installed."));
	}

	CString str = szOutputString;

	return str;
}
Esempio n. 6
0
// ExcelDna - Added exports
bool DetectFxIsNet20Installed()
{
	return IsNetfx20Installed();// && CheckNetfxVersionUsingMscoree(g_szNetfx20VersionString);
}