RegQuery question

Started by stanl, February 10, 2019, 04:01:20 AM

Previous topic - Next topic

stanl

It has been years since I scripted with WB registry functions. Was interested in enabling/disabling One Drive on Win10 [I don't use it and find the pop-ups annoying].

MY BAD: for anyone reading before this edit  \CLSID should just be CLSID


I thought this was correct, but get an error [1452] that the subkey couldn't be opened. Not sure if it's a permission issue or just wrong.


Code (WINBATCH) Select


nOneDrive =RegQueryDword(@REGCLASSES ,"\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}[System.IsPinnedToNameSpaceTree]",0)



this works


Code (WINBATCH) Select


AddExtender("WWREG34I.DLL",0,"WWREG64I.DLL")


#DefineSubroutine OneDrive(q)  ; expects 0,1,3)
retval="Key Exists"
key=RegExistValue(@REGCLASSES ,"CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}[System.IsPinnedToNameSpaceTree]")
If ! key
   retval="Cannot Find One Drive Subkey"
Return(retval)
Else


If q==3 ;just return current settings
   n1 =RegQueryDword(@REGCLASSES ,"CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}[System.IsPinnedToNameSpaceTree]",0)
   n2 =RegQueryDword(@REGCLASSES ,"Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}[System.IsPinnedToNameSpaceTree]",0)
   retval="System.IsPinnedToNameSpaceTree":@LF:n1:@LF:n2
Return(retval)
Else  ; if q=0 disable, if q=1 enable
   RegSetDword(@REGCLASSES ,"CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}[System.IsPinnedToNameSpaceTree]","%q%",0)
   RegSetDword(@REGCLASSES ,"Wow6432NodeCLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}[System.IsPinnedToNameSpaceTree]","%q%",0)
retval="System.IsPinnedToNameSpaceTree":@LF:"Set To ":q
Endif
Return(retval)


#EndSubroutine


Message("One Drive",OneDrive(1))


Exit