Skip to content

Inaccessible Registry Keys Throw Unhandled SecurityException#49

Open
sapph42 wants to merge 2 commits intorodneyviana:masterfrom
sapph42:MultiUserExceptionPatch
Open

Inaccessible Registry Keys Throw Unhandled SecurityException#49
sapph42 wants to merge 2 commits intorodneyviana:masterfrom
sapph42:MultiUserExceptionPatch

Conversation

@sapph42
Copy link

@sapph42 sapph42 commented Mar 12, 2025

If other users on the computer have OneDrive enabled, and the user context running does not have access to every key in HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\SyncRootManager, then OdSyncStatusWS.GetStatusInternal() will throw an unhandled SecurityException.

I have moved the declaration of detail higher in the method, wrapped the dangerous code in a try/catch (with a couple reinits of detail to account for it not being redeclared in every loop), and set detail to a default StatusDetail() if exception is caught. The yield return is moved out of try/catch.

This leads, however, to API.GetStateBySyncRootId potentially being passed a null SyncRootId and throwing an invalid memory access error. I have prevented this in two ways: GetStatusBySyncRootId now has a null check that immediately returns 1. Addtionally, OdSyncStatusWS.GetStatus now checks for a null SyncRootId before calling GetStateBySyncRootId.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant