Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Appending a REG_DWORD and REG_BINARY apposed to a REG_SZ?

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
The_Caddie
1322 Views, 7 Replies

Appending a REG_DWORD and REG_BINARY apposed to a REG_SZ?

It seams to be a quite popular forum question when it comes to the vl-registry-write method, but I can't seam to get it right. Dose anybody know how I can append two keys one which is a REG_DWORD and the other a REG_BINARY key all I'm able to do is create and append REG_SZ keys?

 

 

7 REPLIES 7
Message 2 of 8
The_Caddie
in reply to: The_Caddie

and here some of the tests i have conducted so far (none to any avail)

 

(defun C:hwa1 ()
(vl-registry-write "HKEY_CURRENT_USER\\Software\\Autodesk\\AutoCAD\\R18.2\\ACAD-A001:409\\3DGS Configuration\\GSHEIDI10" "Flags" "00082621 REG_DWORD")
(vl-registry-write "HKEY_CURRENT_USER\\Software\\Autodesk\\AutoCAD\\R18.2\\ACAD-A001:409\\3DGS Configuration\\GSHEIDI10" "FeatureData =hex:7f,02,00,00,5b,02,00,00,7f,02,00,00")
)

(defun C:HWA2 ()

(setq MYHWA1 (strcat "HKEY_CURRENT_USER\\Software\\" (VLAX-PRODUCT-KEY) "\\3DGS Configuration\\GSHEIDI10" "Flags" "=dword:00082622"))
(setq MYHWA2 (strcat "HKEY_CURRENT_USER\\Software\\" (VLAX-PRODUCT-KEY) "\\3DGS Configuration\\GSHEIDI10" "FeatureData" "=hex:7f,02,00,00,5b,02,00,00,7f,02,00,00"))

(vl-registry-write MYHWA1)
(vl-registry-write MYHWA2)

)

(defun C:HWA3 ()

(setq MYHWA1 (strcat "HKEY_CURRENT_USER\\Software\\" (VLAX-PRODUCT-KEY) "\\3DGS Configuration\\GSHEIDI10" "hello stuipid" "00082622"))
(setq MYHWA2 (strcat "HKEY_CURRENT_USER\\Software\\" (VLAX-PRODUCT-KEY) "\\3DGS Configuration\\GSHEIDI10" "FeatureData" "3" "7f,02,00,00,5b,02,00,00,7f,02,00,00"))

(vl-registry-write MYHWA1)
(vl-registry-write MYHWA2)

)

(defun C:HWA4 ()

(vl-registry-write (strcat "HKEY_CURRENT_USER\\Software\\" (VLAX-PRODUCT-KEY) "\\3DGS Configuration\\GSHEIDI10" ) "LOADCTRLS" 2)

)

(defun C:HWA5 ()

(vl-registry-write "HKEY_CURRENT_USER\\Software\\Autodesk\\AutoCAD\\R18.2\\ACAD-A001:409\\3DGS Configuration\\GSHEIDI10" REG_DWORD "Flags" "hello")

)

(defun C:hwa6 ()

				(setq f(open "C:/test2.bat" "w"))
				(write-line "\"HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R18.2\ACAD-A001:409\3DGS Configuration\GSHEIDI10\" /v Flags /t REG_DWORD /d 00082602 /f" f)
				;(write-line \"HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R18.2\ACAD-A001:409\3DGS Configuration\GSHEIDI10\" /v FeatureData /t REG_BINARY /d 7f,02,00,00,5b,02,00,00,7f,02,00,00 /f" f)
(close f)

;REG ADD "HKCU\Control Panel\Desktop" /v BackgroundColor /t REG_BINARY /d ffffff00 /f

(command "_.shell" "C:\test2.bat")

)

 

Message 3 of 8
markruys2
in reply to: The_Caddie

can use vl-registry-wite only for strings... try this, hkcu is the key and n is the binary number

HTH

 

(setq wssh (vlax-create-object "WScript.Shell"))
(vlax-invoke-method wssh 'RegWrite hkcu (vlax-make-variant n 17) "REG_BINARY")
(vlax-release-object wssh)

Message 4 of 8
The_Caddie
in reply to: markruys2

im a little lsot as the following error message keeps poping up?

 

; error: lisp value has no coercion to VARIANT with this type:  nil

Message 5 of 8
markruys2
in reply to: The_Caddie

(vl-load-com)


  (setq hkcu (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\3DGS Configuration\\GSHEIDI10\\Flags") n 534052)


  (setq wssh (vlax-create-object "WScript.Shell"))
  (vlax-invoke-method wssh 'RegWrite hkcu (vlax-make-variant n 3) "REG_DWORD") 
  (vlax-release-object wssh)

 

i am using a long integer decimal value for the flags, i do not know what it does, but it will change it.in the registry

you will have to know which variant data type to use, 2 3 4 5 8 etc

Message 6 of 8
The_Caddie
in reply to: markruys2

nice the dword works but the binary fails?

 

(vl-load-com)

  (setq hkcu (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\3DGS Configuration\\GSHEIDI10\\Flags") n 534050)

  (setq wssh (vlax-create-object "WScript.Shell"))
  (vlax-invoke-method wssh 'RegWrite hkcu (vlax-make-variant n 3) "REG_DWORD") 
  (vlax-release-object wssh)

  (setq hkcu (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\3DGS Configuration\\GSHEIDI10\\FeatureData") n 7f 02 00 00 5b 02 00 00 7f 02 00 00)

  (setq wssh (vlax-create-object "WScript.Shell"))
  (vlax-invoke-method wssh 'RegWrite hkcu (vlax-make-variant n 3) "REG_BINARY") 
  (vlax-release-object wssh)

 

Message 7 of 8
markruys2
in reply to: The_Caddie

 

please assign n to a correct value, in this case it should be an array of binary values

then you should use the correct variant data type, in this case 8192

for example (vlax-make-variant safearray 8192)

you should do more research, i have been successful with simple binary data editing

example (vlax-make-variant 0 17)

never had the need to do list of binary data, but should be doable, if u know what u are doing.

HTH

 

Message 8 of 8
The_Caddie
in reply to: markruys2

getint creates a d-word...

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost