Has anyone been able to write to hkey_local_machine?
I am trying to create a simple security that will allow anyone who logins into the computer and uses any version of AutoCAD to use my new apps.
I am trying to do this with AutoLISP since this is the only language I know.
I just found the dos_regaddkey in dos_lib, but would prefer not to have future users have to load 2 sets of software.
Here is what I have tried so far -
(vl-registry-read "HKEY_LOCAL_MACHINE\\SOFTWARE\\MyCompany\\Data" "" "test")
and
(setq WSobj (vlax-create-object "WScript.Shell"))
(vlax-invoke-method WSobj 'RegWrite "HKEY_LOCAL_MACHINE\\SOFTWARE\\MyCompany\\Data" "test" "REG_SZ")
(if (not (vlax-object-released-p WSobj)) (vlax-release-object WSobj))
vl-Registry-* functions follow your user permission(s) level... So if you cannot write to that hive manually, then you cannot do so via LISP.
The only ways I know of to mitigate this, is to use .NET API (which your IT department will probably frown upon, so I say no more), or to use an Autoloader .bundle here (for 2012😞
%ProgramFiles%\Autodesk\ApplicationPlugins
... Or here (if using 2013+😞
%ProgramData%\Autodesk\ApplicationPlugins
... The last one may still require admin permissions, depending on how your Windows Profile is configured for the purposes of CAD.
The only other alternative that I can think of, is to write to external file somewhere common to the C:\ drive rather than registry.
HTH
"How we think determines what we do, and what we do determines what we get."