aboutsummaryrefslogtreecommitdiff
path: root/src/ca/vsca.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ca/vsca.cpp')
-rw-r--r--src/ca/vsca.cpp81
1 files changed, 81 insertions, 0 deletions
diff --git a/src/ca/vsca.cpp b/src/ca/vsca.cpp
index 30174672..ac045db8 100644
--- a/src/ca/vsca.cpp
+++ b/src/ca/vsca.cpp
@@ -47,6 +47,12 @@ static HRESULT ProcessVS2017(
47 __in BOOL fComplete 47 __in BOOL fComplete
48 ); 48 );
49 49
50static HRESULT ProcessVS2019(
51 __in_opt ISetupInstance* pInstance,
52 __in DWORD64 qwVersion,
53 __in BOOL fComplete
54);
55
50static HRESULT SetPropertyForComponent( 56static HRESULT SetPropertyForComponent(
51 __in DWORD cComponents, 57 __in DWORD cComponents,
52 __in VS_COMPONENT_PROPERTY* rgComponents, 58 __in VS_COMPONENT_PROPERTY* rgComponents,
@@ -56,6 +62,7 @@ static HRESULT SetPropertyForComponent(
56static VS_INSTANCE vrgInstances[] = 62static VS_INSTANCE vrgInstances[] =
57{ 63{
58 { FILEMAKEVERSION(15, 0, 0, 0), FILEMAKEVERSION(15, 0xffff, 0xffff, 0xffff), ProcessVS2017 }, 64 { FILEMAKEVERSION(15, 0, 0, 0), FILEMAKEVERSION(15, 0xffff, 0xffff, 0xffff), ProcessVS2017 },
65 { FILEMAKEVERSION(16, 0, 0, 0), FILEMAKEVERSION(16, 0xffff, 0xffff, 0xffff), ProcessVS2019 },
59}; 66};
60 67
61/****************************************************************** 68/******************************************************************
@@ -407,6 +414,80 @@ LExit:
407 return hr; 414 return hr;
408} 415}
409 416
417static HRESULT ProcessVS2019(
418 __in_opt ISetupInstance* pInstance,
419 __in DWORD64 qwVersion,
420 __in BOOL fComplete
421)
422{
423 static ISetupInstance* pLatest = NULL;
424 static DWORD64 qwLatest = 0;
425
426 static LPCWSTR rgwzProducts[] =
427 {
428 L"Microsoft.VisualStudio.Product.Community",
429 L"Microsoft.VisualStudio.Product.Professional",
430 L"Microsoft.VisualStudio.Product.Enterprise",
431 };
432
433 // TODO: Consider making table-driven with these defaults per-version for easy customization.
434 static VS_COMPONENT_PROPERTY rgComponents[] =
435 {
436 { L"Microsoft.VisualStudio.Component.FSharp", L"VS2019_IDE_FSHARP_PROJECTSYSTEM_INSTALLED" },
437 { L"Microsoft.VisualStudio.Component.Roslyn.LanguageServices", L"VS2019_IDE_VB_PROJECTSYSTEM_INSTALLED" },
438 { L"Microsoft.VisualStudio.Component.Roslyn.LanguageServices", L"VS2019_IDE_VCSHARP_PROJECTSYSTEM_INSTALLED" },
439 { L"Microsoft.VisualStudio.Component.TestTools.Core", L"VS2019_IDE_VSTS_TESTSYSTEM_INSTALLED" },
440 { L"Microsoft.VisualStudio.Component.VC.CoreIde", L"VS2019_IDE_VC_PROJECTSYSTEM_INSTALLED" },
441 { L"Microsoft.VisualStudio.Component.Web", L"VS2019_IDE_VWD_PROJECTSYSTEM_INSTALLED" },
442 { L"Microsoft.VisualStudio.PackageGroup.DslRuntime", L"VS2019_IDE_MODELING_PROJECTSYSTEM_INSTALLED" },
443 };
444
445 HRESULT hr = S_OK;
446
447 if (fComplete)
448 {
449 if (pLatest)
450 {
451 hr = ProcessInstance(pLatest, L"VS2019_ROOT_FOLDER", countof(rgComponents), rgComponents);
452 ExitOnFailure(hr, "Failed to process VS2019 instance.");
453 }
454 }
455 else if (pInstance)
456 {
457 hr = InstanceInProducts(pInstance, countof(rgwzProducts), rgwzProducts);
458 ExitOnFailure(hr, "Failed to compare product IDs.");
459
460 if (S_FALSE == hr)
461 {
462 ExitFunction();
463 }
464
465 hr = InstanceIsGreater(pLatest, qwLatest, pInstance, qwVersion);
466 ExitOnFailure(hr, "Failed to compare instances.");
467
468 if (S_FALSE == hr)
469 {
470 ExitFunction();
471 }
472
473 ReleaseNullObject(pLatest);
474
475 pLatest = pInstance;
476 qwLatest = qwVersion;
477
478 // Caller will do a final Release() otherwise.
479 pLatest->AddRef();
480 }
481
482LExit:
483 if (fComplete)
484 {
485 ReleaseObject(pLatest);
486 }
487
488 return hr;
489}
490
410static HRESULT SetPropertyForComponent( 491static HRESULT SetPropertyForComponent(
411 __in DWORD cComponents, 492 __in DWORD cComponents,
412 __in VS_COMPONENT_PROPERTY* rgComponents, 493 __in VS_COMPONENT_PROPERTY* rgComponents,