FEATURE REQUEST: Program UUIDs for the Windows Registry

%3CLINGO-SUB%20id%3D%22lingo-sub-307401%22%20slang%3D%22en-US%22%3EFEATURE%20REQUEST%3A%20Program%20UUIDs%20for%20the%20Windows%20Registry%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-307401%22%20slang%3D%22en-US%22%3E%3CP%3ERequest%3A%20Introduce%20Program%20UUIDs%20into%20the%20Windows%20Registry%20to%20better%20manage%20all%20of%20the%20registry%20keys%20associated%20with%20a%20program%20throughout%20its%20lifetime%20on%20the%20system.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIdea%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20a%20program%20executes%20on%20the%20system%20regardless%20of%20if%20it%20went%20through%20a%20standard%20MSI%20installation%20or%20is%20a%20standalone%20executable%20downloaded%20from%20the%20internet%2C%20the%20kernel%20should%20generate%20a%20UUID%20from%20the%20contents%20of%20the%20program%20such%20as%20an%20SHA-1%20hash%20from%20the%20executable's%20contents%20the%20first%20time%20that%20program%20is%20executed.%20The%20UUID%20should%20not%20be%20generated%20if%20it%20does%20not%20ever%20execute%2C%20The%20kernel%20would%20store%20this%20on%20disk%20in%20a%20secret%20and%20privileged%20program%20UUID%20table.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20UUID%20table%20would%20be%20a%20memory%20mapped%20file%20when%20the%20operating%20system%20initializes%20so%20that%20it%20could%20make%20use%20of%20the%20kernel's%20file%20cache%20as%20well%20as%20not%20having%20to%20routinely%20call%20the%20file%20management%20APIs.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAfter%20the%20kernel%20assigns%20a%20UUID%20with%20the%20program%2C%20the%20executable%20file%20on%20disk%20will%20have%20a%20bit%20updated%20which%20states%20that%20it%20was%20assigned%20a%20UUID.%20Copies%20of%20the%20executable%20file%20will%20share%20that%20UUID%20as%20long%20as%20the%20contents%20of%20the%20file%20are%20not%20changed%20or%20updated%2C%20when%20they%20are%20then%20a%20dirty%20bit%20is%20set%20for%20the%20file%20indicating%20to%20the%20kernel%20that%20the%20next%20time%20it%20executes%20it%20should%20generate%20a%20new%20UUID%20for%20that%20file.%20Downloaded%20files%20that%20execute%20which%20generate%20the%20same%20UUID%20as%20another%20program%20based%20off%20of%20its%20contents%20should%20also%20share%20that%20UUID.%20When%20the%20kernel%20loads%20the%20file%20into%20main%20memory%2C%20this%20UUID%20bit%20should%20be%20checked%20conditionally%2C%20if%20it%20already%20exists%20then%20it%20skips%20over%20the%20routine%20that%20assigns%20it%20and%20then%20it%20grabs%20a%20reference%20to%20the%20UUID%20in%20the%20UUID%20table%20for%20that%20program's%20runtime.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20the%20program%20makes%20modifications%20to%20the%20Windows%20registry%20by%20calling%20routines%20such%20as%26nbsp%3BRegCreateKey%2C%20the%20kernel%20will%20check%20the%20program%20UUID%20of%20the%20process%20from%20which%20the%20thread%20is%20executing%20and%20then%20assign%20it%20as%20an%20attribute%20to%20that%20registry%20key.%20This%20allows%20administrators%20to%20know%20which%20keys%20were%20created%20by%20which%20programs%20when%20managing%20them%20or%20uninstalling%20them%20because%20some%20programs%20don't%20completely%20clean%20up%20after%20themselves%20in%20the%20registry.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECmdlets%20that%20could%20be%20used%20with%20PowerShell%20for%20this%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGet-ProgramUUID%20%3CPROGRAM%3E%20%26lt%3B%23%20Gets%20the%20UUID%20for%20the%20program%20%23%26gt%3B%3C%2FPROGRAM%3E%3C%2FP%3E%3CP%3EEnum-ProgramUUID%20%3CPROGRAM%3E%20%26lt%3B%23%20Enumerates%20each%20registry%20key%20the%20program%20added%20%23%26gt%3B%3CBR%20%2F%3ERegDelete-ProgramUUID%20%3CPROGRAM%3E%20%26lt%3B%23%20Deletes%20all%20keys%20associated%20with%20the%20program%20%23%26gt%3B%3CBR%20%2F%3E%3CBR%20%2F%3EPossible%20Development%20Issues%3A%3CBR%20%2F%3E-%20Adding%20new%20data%20structures%20to%20the%20Windows%20kernel%20and%20revising%20some%20such%20as%20EPROCESS%3CBR%20%2F%3E-%20Modifying%20how%20the%20registry%20database%20works%20by%20adding%20in%20attributes%20such%20as%20UUIDs%3CBR%20%2F%3E-%20Adding%20new%20API%20calls%20to%20interface%20with%20UUIDs%3CBR%20%2F%3E-%20Modifying%20existing%20API%20calls%20in%20the%20kernel%3CBR%20%2F%3E%3CBR%20%2F%3EA%20major%20obstacle%20is%20most%20likely%20having%20duplicate%20files%3CBR%20%2F%3E%3CBR%20%2F%3EThanks%3C%2FPROGRAM%3E%3C%2FPROGRAM%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Deleted
Not applicable

Request: Introduce Program UUIDs into the Windows Registry to better manage all of the registry keys associated with a program throughout its lifetime on the system.

 

Idea:

 

When a program executes on the system regardless of if it went through a standard MSI installation or is a standalone executable downloaded from the internet, the kernel should generate a UUID from the contents of the program such as an SHA-1 hash from the executable's contents the first time that program is executed. The UUID should not be generated if it does not ever execute, The kernel would store this on disk in a secret and privileged program UUID table.

 

The UUID table would be a memory mapped file when the operating system initializes so that it could make use of the kernel's file cache as well as not having to routinely call the file management APIs.

 

After the kernel assigns a UUID with the program, the executable file on disk will have a bit updated which states that it was assigned a UUID. Copies of the executable file will share that UUID as long as the contents of the file are not changed or updated, when they are then a dirty bit is set for the file indicating to the kernel that the next time it executes it should generate a new UUID for that file. Downloaded files that execute which generate the same UUID as another program based off of its contents should also share that UUID. When the kernel loads the file into main memory, this UUID bit should be checked conditionally, if it already exists then it skips over the routine that assigns it and then it grabs a reference to the UUID in the UUID table for that program's runtime.

 

When the program makes modifications to the Windows registry by calling routines such as RegCreateKey, the kernel will check the program UUID of the process from which the thread is executing and then assign it as an attribute to that registry key. This allows administrators to know which keys were created by which programs when managing them or uninstalling them because some programs don't completely clean up after themselves in the registry.

 

Cmdlets that could be used with PowerShell for this:

 

Get-ProgramUUID <Program> <# Gets the UUID for the program #>

Enum-ProgramUUID <Program> <# Enumerates each registry key the program added #>
RegDelete-ProgramUUID <Program> <# Deletes all keys associated with the program #>

Possible Development Issues:
- Adding new data structures to the Windows kernel and revising some such as EPROCESS
- Modifying how the registry database works by adding in attributes such as UUIDs
- Adding new API calls to interface with UUIDs
- Modifying existing API calls in the kernel

A major obstacle is most likely having duplicate files

Thanks

0 Replies