乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 53|回复: 6

[编程交流] How to read hexadecimal ( bina

[复制链接]

91

主题

428

帖子

326

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
474
发表于 2022-7-6 06:29:42 | 显示全部楼层 |阅读模式
Hi All,
 
as most of you know, (vl-registry-read) is a good function to get data out of windows registry.
 
It works nice for string and decimal number data, but not works correct for hexadecimal (or binary) data.
 
For example, if you issue this:
 
  1. (vl-registry-read "[b]HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\RecentDocs[/b]" "[b]MRUListEx[/b]")
 
you will find '(3) or something similar as the result, but the data exported by Windows "REGEDIT" command on my PC is as seen below:
 
 
How is it possible to get hexadecimal (binary) data from registry.
 
(In the following step, I guess I can convert binary data to strings.)
 
Any help, clues or suggestions are greatly appreciated.
回复

使用道具 举报

4

主题

35

帖子

33

银币

初来乍到

Rank: 1

铜币
19
发表于 2022-7-6 06:41:59 | 显示全部楼层
the results i found to get the value of reg_binary is "wscript.shell".
i tried to manipulate in AutoCAD but the result is error.
 
(vlax-invoke (vlax-create-object "WScript.Shell") 'regread "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\EventLog\\Security\\Sources\\")
 
result
WshShell.RegRead: Invalid root in registry key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Security\Sources\".
回复

使用道具 举报

11

主题

968

帖子

919

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
99
发表于 2022-7-6 06:52:33 | 显示全部楼层
First, what windows are you using? Some registry keys have been renamed, and in some cases you're not allowed to read some keys. E.g. I can't find the EventLog security sources on my Win7-Pro 64 unless I'm using an admisnistrator account.
 
Also the RegRead from the WScript does not return a path's keys. You'll need to return a specific key. E.g. from the OP's path, in my windows that "folder" contains subfolders as well as keys numbered from 0 through to 149. E.g.
  1. Command: (setq ws (vlax-create-object "WScript.Shell") )#Command: (vlax-invoke ws 'RegRead "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\RecentDocs\\0")(83 0 97 0 109 0 112 0 108 0 101 0 32 0 66 0 111 0 97 0 114 0 100 0 115 0 0 0 112 0 50 0 0 0 0 0 0 0 0 0 0 0 83 97 109 112 108 101 32 66 111 97 114 100 115 46 108 110 107 0 80 0 8 0 4 0 239 190 0 0 0 0 0 0 0 0 42 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 83 0 97 0 109 0 112 0 108 0 101 0 32 0 66 0 111 0 97 0 114 0 100 0 115 0 46 0 108 0 110 0 107 0 0 0 32 0 0 0)
 
And to save yourself some issue in the future, remember to keep a variable pointing to the object generated by that vlax-create-object function. So you can vlax-release-object later. These ActiveX objects don't get garbage collected like normal lisp variables do, so could end up causing RAM leakage and / or crashes. If you don't keep track of them, there's no way for you to clear them later.
回复

使用道具 举报

4

主题

35

帖子

33

银币

初来乍到

Rank: 1

铜币
19
发表于 2022-7-6 07:01:36 | 显示全部楼层
 
Irneb, Im using windows 7 - premium 64
In my case, the specified key is in the registry.
 
  1. Command: (setq ws (vlax-create-object "WScript.Shell") )#Command: (vlax-invoke ws 'RegRead (vlax-invoke ws 'RegRead "HKLM\\SYSTEM\\MountedDevices\\DosDevices\\C:")WshShell.RegRead: Invalid root in registry key "HKLM\SYSTEM\MountedDevices\DosDevices\C:".
Maybe the key I specified is a case that is not allowed to be read.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 07:17:41 | 显示全部楼层
Reading registry keys from the HKLM hive may require administrator priviledges, or may not be available through Scripting for security reasons.
回复

使用道具 举报

11

主题

968

帖子

919

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
99
发表于 2022-7-6 07:26:54 | 显示全部楼层
Yep, if at all possible try to stick with HKCU instead. That usually gives the least trouble as most of them are supposed to be user settings and should thus be (at least) readable by the user's security level. 
The HKLM is not always unavailable, but chances are that lots of those are set to System security level. Therefore you need admin rights to even see them. And most (if not all) companies disallow admin user rights on their PC's to try stopping viruses and such. If the key is only available in HKLM, then try to use something else to get similar data - e.g. if you want to find the drives connected to the PC, perhaps try the FileSystem object's Drives property: http://msdn.microsoft.com/en-us/library/aa242690%28v=VS.60%29.aspx
回复

使用道具 举报

4

主题

35

帖子

33

银币

初来乍到

Rank: 1

铜币
19
发表于 2022-7-6 07:35:58 | 显示全部楼层
  1. Command: (setq sfso (vlax-create-object "Scripting.FileSystemObject"))#Command: (vlax-dump-object (vlax-invoke sfso 'getdrive "H:\") T); IDrive: Drive Interface; Property values:;   AvailableSpace (RO) = 4.14759e+009;   DriveLetter (RO) = "H";   DriveType (RO) = 1;   FileSystem (RO) = "FAT32";   FreeSpace (RO) = 4.14759e+009;   IsReady (RO) = -1;   Path (RO) = "H:";   RootFolder (RO) = #;   SerialNumber (RO) = -1131567886;   ShareName (RO) = "";   TotalSize (RO) = 8.09918e+009;   VolumeName = "LANLOY 8GB"; No methodsT
Now I'm relieved!!
"Wscript.Shell" and "Scripting.FileSystemObject" are the main event of this thread
Especially to both (Irneb and Lee Mac) of you guys.. Thanks a lot.
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-10 15:18 , Processed in 0.844012 second(s), 66 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表