Skip to content

Commit

Permalink
Try to prevent update of user-type Windows installation when running …
Browse files Browse the repository at this point in the history
…as admin (microsoft#148428)
  • Loading branch information
gjsjohnmurray committed Jul 19, 2022
1 parent 6a4e5cc commit df37a54
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/vs/platform/update/electron-main/updateService.win32.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,22 @@ export class Win32UpdateService extends AbstractUpdateService {
return createUpdateURL(platform, quality, this.productService);
}

override async checkForUpdates(explicit: boolean): Promise<void> {

this.logService.trace('update#checkForUpdates, state = ', this.state.type);

if (this.state.type !== StateType.Idle) {
return;
}

if (this.productService.target === 'user' && await this.nativeHostMainService.isAdmin(undefined)) {
this.logService.info('update - updates are disabled when Windows user installation is running as administrator');
return;
}

this.doCheckForUpdates(explicit);
}

protected doCheckForUpdates(context: any): void {
if (!this.url) {
return;
Expand Down

0 comments on commit df37a54

Please sign in to comment.