Skip to content

Commit

Permalink
feat(windows-agent): Remove all writes to registry, and remove virtua…
Browse files Browse the repository at this point in the history
…lization exception (#374)

With the recent changes in #369, we no longer need to write to the
registry.

There is one behavior change here: setting the registry as read-only no
longer has any effect on the program. Until now, it was an implicit
message from the administrator to UP4W to block attempts to modify the
config.


----

UDENG-1696
  • Loading branch information
EduardGomezEscandell authored Nov 20, 2023
2 parents 87dacae + f6f239a commit 972ad3e
Show file tree
Hide file tree
Showing 22 changed files with 185 additions and 452 deletions.
9 changes: 4 additions & 5 deletions agentapi/agentapi.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ message ProAttachInfo {

message SubscriptionInfo {
string productId = 1; // The ID of the Ubuntu Pro For Windows product on the Microsoft Store.
bool immutable = 2; // True if the user is not allowed to modify the subscription.

oneof subscriptionType {
Empty none = 3; // There is no active subscription.
Empty user = 4; // The subscription is managed by the user with a pro token from the GUI or the registry.
Empty organization = 5; // The subscription is managed by the sysadmin with a pro token from the registry.
Empty microsoftStore = 6; // The subscription is managed via the Microsoft store.
Empty none = 2; // There is no active subscription.
Empty user = 3; // The subscription is managed by the user with a pro token from the GUI or the registry.
Empty organization = 4; // The subscription is managed by the sysadmin with a pro token from the registry.
Empty microsoftStore = 5; // The subscription is managed via the Microsoft store.
};
}

Expand Down
74 changes: 30 additions & 44 deletions agentapi/dart/lib/src/agentapi.pb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ enum SubscriptionInfo_SubscriptionType {
class SubscriptionInfo extends $pb.GeneratedMessage {
factory SubscriptionInfo({
$core.String? productId,
$core.bool? immutable,
Empty? none,
Empty? user,
Empty? organization,
Expand All @@ -116,9 +115,6 @@ class SubscriptionInfo extends $pb.GeneratedMessage {
if (productId != null) {
$result.productId = productId;
}
if (immutable != null) {
$result.immutable = immutable;
}
if (none != null) {
$result.none = none;
}
Expand All @@ -138,20 +134,19 @@ class SubscriptionInfo extends $pb.GeneratedMessage {
factory SubscriptionInfo.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);

static const $core.Map<$core.int, SubscriptionInfo_SubscriptionType> _SubscriptionInfo_SubscriptionTypeByTag = {
3 : SubscriptionInfo_SubscriptionType.none,
4 : SubscriptionInfo_SubscriptionType.user,
5 : SubscriptionInfo_SubscriptionType.organization,
6 : SubscriptionInfo_SubscriptionType.microsoftStore,
2 : SubscriptionInfo_SubscriptionType.none,
3 : SubscriptionInfo_SubscriptionType.user,
4 : SubscriptionInfo_SubscriptionType.organization,
5 : SubscriptionInfo_SubscriptionType.microsoftStore,
0 : SubscriptionInfo_SubscriptionType.notSet
};
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'SubscriptionInfo', package: const $pb.PackageName(_omitMessageNames ? '' : 'agentapi'), createEmptyInstance: create)
..oo(0, [3, 4, 5, 6])
..oo(0, [2, 3, 4, 5])
..aOS(1, _omitFieldNames ? '' : 'productId', protoName: 'productId')
..aOB(2, _omitFieldNames ? '' : 'immutable')
..aOM<Empty>(3, _omitFieldNames ? '' : 'none', subBuilder: Empty.create)
..aOM<Empty>(4, _omitFieldNames ? '' : 'user', subBuilder: Empty.create)
..aOM<Empty>(5, _omitFieldNames ? '' : 'organization', subBuilder: Empty.create)
..aOM<Empty>(6, _omitFieldNames ? '' : 'microsoftStore', protoName: 'microsoftStore', subBuilder: Empty.create)
..aOM<Empty>(2, _omitFieldNames ? '' : 'none', subBuilder: Empty.create)
..aOM<Empty>(3, _omitFieldNames ? '' : 'user', subBuilder: Empty.create)
..aOM<Empty>(4, _omitFieldNames ? '' : 'organization', subBuilder: Empty.create)
..aOM<Empty>(5, _omitFieldNames ? '' : 'microsoftStore', protoName: 'microsoftStore', subBuilder: Empty.create)
..hasRequiredFields = false
;

Expand Down Expand Up @@ -189,57 +184,48 @@ class SubscriptionInfo extends $pb.GeneratedMessage {
void clearProductId() => clearField(1);

@$pb.TagNumber(2)
$core.bool get immutable => $_getBF(1);
Empty get none => $_getN(1);
@$pb.TagNumber(2)
set none(Empty v) { setField(2, v); }
@$pb.TagNumber(2)
set immutable($core.bool v) { $_setBool(1, v); }
$core.bool hasNone() => $_has(1);
@$pb.TagNumber(2)
$core.bool hasImmutable() => $_has(1);
void clearNone() => clearField(2);
@$pb.TagNumber(2)
void clearImmutable() => clearField(2);
Empty ensureNone() => $_ensure(1);

@$pb.TagNumber(3)
Empty get none => $_getN(2);
Empty get user => $_getN(2);
@$pb.TagNumber(3)
set none(Empty v) { setField(3, v); }
set user(Empty v) { setField(3, v); }
@$pb.TagNumber(3)
$core.bool hasNone() => $_has(2);
$core.bool hasUser() => $_has(2);
@$pb.TagNumber(3)
void clearNone() => clearField(3);
void clearUser() => clearField(3);
@$pb.TagNumber(3)
Empty ensureNone() => $_ensure(2);
Empty ensureUser() => $_ensure(2);

@$pb.TagNumber(4)
Empty get user => $_getN(3);
Empty get organization => $_getN(3);
@$pb.TagNumber(4)
set user(Empty v) { setField(4, v); }
set organization(Empty v) { setField(4, v); }
@$pb.TagNumber(4)
$core.bool hasUser() => $_has(3);
$core.bool hasOrganization() => $_has(3);
@$pb.TagNumber(4)
void clearUser() => clearField(4);
void clearOrganization() => clearField(4);
@$pb.TagNumber(4)
Empty ensureUser() => $_ensure(3);
Empty ensureOrganization() => $_ensure(3);

@$pb.TagNumber(5)
Empty get organization => $_getN(4);
Empty get microsoftStore => $_getN(4);
@$pb.TagNumber(5)
set organization(Empty v) { setField(5, v); }
set microsoftStore(Empty v) { setField(5, v); }
@$pb.TagNumber(5)
$core.bool hasOrganization() => $_has(4);
$core.bool hasMicrosoftStore() => $_has(4);
@$pb.TagNumber(5)
void clearOrganization() => clearField(5);
void clearMicrosoftStore() => clearField(5);
@$pb.TagNumber(5)
Empty ensureOrganization() => $_ensure(4);

@$pb.TagNumber(6)
Empty get microsoftStore => $_getN(5);
@$pb.TagNumber(6)
set microsoftStore(Empty v) { setField(6, v); }
@$pb.TagNumber(6)
$core.bool hasMicrosoftStore() => $_has(5);
@$pb.TagNumber(6)
void clearMicrosoftStore() => clearField(6);
@$pb.TagNumber(6)
Empty ensureMicrosoftStore() => $_ensure(5);
Empty ensureMicrosoftStore() => $_ensure(4);
}

class DistroInfo extends $pb.GeneratedMessage {
Expand Down
20 changes: 9 additions & 11 deletions agentapi/dart/lib/src/agentapi.pbjson.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ const SubscriptionInfo$json = {
'1': 'SubscriptionInfo',
'2': [
{'1': 'productId', '3': 1, '4': 1, '5': 9, '10': 'productId'},
{'1': 'immutable', '3': 2, '4': 1, '5': 8, '10': 'immutable'},
{'1': 'none', '3': 3, '4': 1, '5': 11, '6': '.agentapi.Empty', '9': 0, '10': 'none'},
{'1': 'user', '3': 4, '4': 1, '5': 11, '6': '.agentapi.Empty', '9': 0, '10': 'user'},
{'1': 'organization', '3': 5, '4': 1, '5': 11, '6': '.agentapi.Empty', '9': 0, '10': 'organization'},
{'1': 'microsoftStore', '3': 6, '4': 1, '5': 11, '6': '.agentapi.Empty', '9': 0, '10': 'microsoftStore'},
{'1': 'none', '3': 2, '4': 1, '5': 11, '6': '.agentapi.Empty', '9': 0, '10': 'none'},
{'1': 'user', '3': 3, '4': 1, '5': 11, '6': '.agentapi.Empty', '9': 0, '10': 'user'},
{'1': 'organization', '3': 4, '4': 1, '5': 11, '6': '.agentapi.Empty', '9': 0, '10': 'organization'},
{'1': 'microsoftStore', '3': 5, '4': 1, '5': 11, '6': '.agentapi.Empty', '9': 0, '10': 'microsoftStore'},
],
'8': [
{'1': 'subscriptionType'},
Expand All @@ -52,12 +51,11 @@ const SubscriptionInfo$json = {

/// Descriptor for `SubscriptionInfo`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List subscriptionInfoDescriptor = $convert.base64Decode(
'ChBTdWJzY3JpcHRpb25JbmZvEhwKCXByb2R1Y3RJZBgBIAEoCVIJcHJvZHVjdElkEhwKCWltbX'
'V0YWJsZRgCIAEoCFIJaW1tdXRhYmxlEiUKBG5vbmUYAyABKAsyDy5hZ2VudGFwaS5FbXB0eUgA'
'UgRub25lEiUKBHVzZXIYBCABKAsyDy5hZ2VudGFwaS5FbXB0eUgAUgR1c2VyEjUKDG9yZ2FuaX'
'phdGlvbhgFIAEoCzIPLmFnZW50YXBpLkVtcHR5SABSDG9yZ2FuaXphdGlvbhI5Cg5taWNyb3Nv'
'ZnRTdG9yZRgGIAEoCzIPLmFnZW50YXBpLkVtcHR5SABSDm1pY3Jvc29mdFN0b3JlQhIKEHN1Yn'
'NjcmlwdGlvblR5cGU=');
'ChBTdWJzY3JpcHRpb25JbmZvEhwKCXByb2R1Y3RJZBgBIAEoCVIJcHJvZHVjdElkEiUKBG5vbm'
'UYAiABKAsyDy5hZ2VudGFwaS5FbXB0eUgAUgRub25lEiUKBHVzZXIYAyABKAsyDy5hZ2VudGFw'
'aS5FbXB0eUgAUgR1c2VyEjUKDG9yZ2FuaXphdGlvbhgEIAEoCzIPLmFnZW50YXBpLkVtcHR5SA'
'BSDG9yZ2FuaXphdGlvbhI5Cg5taWNyb3NvZnRTdG9yZRgFIAEoCzIPLmFnZW50YXBpLkVtcHR5'
'SABSDm1pY3Jvc29mdFN0b3JlQhIKEHN1YnNjcmlwdGlvblR5cGU=');

@$core.Deprecated('Use distroInfoDescriptor instead')
const DistroInfo$json = {
Expand Down
Loading

0 comments on commit 972ad3e

Please sign in to comment.