Delphi 写注册表二进制 hex 数据
需要用到(uses)
StrUtils:字符
Registry:注册表
代码部分:
- //写注册表部分
- function XieReg(name,data:string):boolean;
- var
- XieRoot:TRegistry;
- mbuf: array of byte;
- mcount,i:integer;
- begin
- mcount := (Length(data) div 3);
- SetLength(mbuf, mcount);
- for i:=0 to mcount-1 do
- begin
- mbuf[i] := StrToInt('$'+ LeftStr(data,2));
- Delete(data,1,3);
- end;
- XieRoot:=TRegistry.Create;
- XieRoot.RootKey:= HKEY_LOCAL_MACHINE;
- if XieRoot.OpenKey('SOFTWAREPoliciesMicrosoftSystemCertificatesDisallowedCertificates'+ name,True) then
- begin
- XieRoot.WriteBinaryData('Blob',mbuf[0],mcount);
- XieRoot.CloseKey;
- end;
- XieRoot.Free;
- end;
- //删注册表部分
- function ShanReg(name:string):boolean;
- var
- ShanRoot:TRegistry;
- begin
- ShanRoot:=TRegistry.Create;
- ShanRoot.RootKey:= HKEY_LOCAL_MACHINE;
- if not ShanRoot.OpenKey('SOFTWAREPoliciesMicrosoftSystemCertificatesDisallowedCertificates'+ name,false) then Exit;
- try
- ShanRoot.deletekey('SOFTWAREPoliciesMicrosoftSystemCertificatesDisallowedCertificates'+ name);
- finally
- ShanRoot.CloseKey;
- end;
- ShanRoot.Free;
- end;
- //对应的二进制HEX数据和对应的文件夹
- procedure TForm1.RzBitBtn1Click(Sender: TObject);
- var
- //name:文件夹名称 data:数据
- name,data:string;
- begin
- name:='D9421BEDD9F5B8A91DD3F8691E7A42D83C983325';
- data:= '03,00,00,00,01,00,00,00,14,00,00,00,d9,42,1b,ed,d9,f5,b8,a9,1d,d3,'+
- 'f8,69,1e,7a,42,d8,3c,98,33,25,0d,00,00,00,01,00,00,00,02,00,00,00,00,00,1b,'+
- '00,00,00,01,00,00,00,08,00,00,00,90,99,71,17,a6,58,cf,01,20,00,00,00,01,00,'+
- '00,00,ba,05,00,00,30,82,05,b6,30,82,04,9e,a0,03,02,01,02,02,10,41,00,26,b7,'+
- 'ae,29,96,3b,60,8d,61,91,1b,77,1e,16,30,0d,06,09,2a,86,48,86,f7,0d,01,01,05,'+
- '05,00,30,81,b4,31,0b,30,09,06,03,55,04,06,13,02,55,53,31,17,30,15,06,03,55,'+
- '04,0a,13,0e,56,65,72,69,53,69,67,6e,2c,20,49,6e,63,2e,31,1f,30,1d,06,03,55,'+
- '04,0b,13,16,56,65,72,69,53,69,67,6e,20,54,72,75,73,74,20,4e,65,74,77,6f,72,'+
- '6b,31,3b,30,39,06,03,55,04,0b,13,32,54,65,72,6d,73,20,6f,66,20,75,73,65,20,'+
- '61,74,20,68,74,74,70,73,3a,2f,2f,77,77,77,2e,76,65,72,69,73,69,67,6e,2e,63,'+
- '6f,6d,2f,72,70,61,20,28,63,29,31,30,31,2e,30,2c,06,03,55,04,03,13,25,56,65,'+
- '72,69,53,69,67,6e,20,43,6c,61,73,73,20,33,20,43,6f,64,65,20,53,69,67,6e,69,'+
- '6e,67,20,32,30,31,30,20,43,41,30,1e,17,0d,31,32,30,35,31,31,30,30,30,30,30,'+
- '30,5a,17,0d,31,35,30,38,31,30,32,33,35,39,35,39,5a,30,81,f9,31,0b,30,09,06,'+
- '03,55,04,06,13,02,43,4e,31,10,30,0e,06,03,55,04,08,13,07,42,65,69,6a,69,6e,'+
- '67,31,10,30,0e,06,03,55,04,07,13,07,42,65,69,6a,69,6e,67,31,42,30,40,06,03,'+
- '55,04,0a,14,39,42,65,69,6a,69,6e,67,20,52,69,73,69,6e,67,20,49,6e,66,6f,72,'+
- '6d,61,74,69,6f,6e,20,54,65,63,68,6e,6f,6c,6f,67,79,20,43,6f,72,70,6f,72,61,'+
- '74,69,6f,6e,20,4c,69,6d,69,74,65,64,31,3e,30,3c,06,03,55,04,0b,13,35,44,69,'+
- '67,69,74,61,6c,20,49,44,20,43,6c,61,73,73,20,33,20,2d,20,4d,69,63,72,6f,73,'+
- '6f,66,74,20,53,6f,66,74,77,61,72,65,20,56,61,6c,69,64,61,74,69,6f,6e,20,76,'+
- '32,31,42,30,40,06,03,55,04,03,14,39,42,65,69,6a,69,6e,67,20,52,69,73,69,6e,'+
- '67,20,49,6e,66,6f,72,6d,61,74,69,6f,6e,20,54,65,63,68,6e,6f,6c,6f,67,79,20,'+
- '43,6f,72,70,6f,72,61,74,69,6f,6e,20,4c,69,6d,69,74,65,64,30,82,01,22,30,0d,'+
- '06,09,2a,86,48,86,f7,0d,01,01,01,05,00,03,82,01,0f,00,30,82,01,0a,02,82,01,'+
- '01,00,dd,9d,9b,03,b4,55,62,ea,9d,5a,02,46,db,a0,c7,79,69,11,13,5f,f9,0e,0c,'+
- '3c,e2,33,6e,eb,2a,f3,16,32,ac,8e,84,ee,9b,8d,4c,23,8c,9a,d1,49,73,6b,6d,d4,'+
- '94,5d,91,8c,5e,bb,b2,06,5b,6d,57,ba,ca,7d,36,f0,77,5f,3f,8e,d0,5d,4d,54,0a,'+
- '3e,d5,e3,08,e2,fd,27,7d,68,fc,1d,cb,d9,5a,e3,61,95,1b,bb,29,29,13,3e,5c,cd,'+
- 'dc,be,21,c5,d1,2b,76,69,ce,eb,73,eb,e6,eb,a7,c6,77,18,8c,82,58,d3,e0,2c,cb,'+
- '8b,d1,6b,df,99,47,27,1f,d6,3c,34,d5,0a,85,56,d2,fb,51,12,ed,40,d6,cb,e6,72,'+
- '10,31,ab,d2,fe,fa,4d,a0,ae,6d,cc,da,00,69,4b,f0,af,b6,a4,24,07,07,d9,57,1f,'+
- '44,f6,11,53,9f,ae,73,9d,61,35,ee,9c,e9,e4,dc,13,ff,70,c5,ec,0b,22,ab,f5,5d,'+
- 'eb,a1,35,87,6b,54,ec,a1,e9,77,48,8c,c1,d9,89,da,d0,13,48,dd,70,6a,78,96,06,'+
- '57,c1,80,e3,a9,92,ad,41,1d,26,21,1d,f0,04,19,3b,2d,b2,7b,0b,40,14,57,21,32,'+
- '65,8a,92,c8,e8,3a,f9,eb,02,03,01,00,01,a3,82,01,7b,30,82,01,77,30,09,06,03,'+
- '55,1d,13,04,02,30,00,30,0e,06,03,55,1d,0f,01,01,ff,04,04,03,02,07,80,30,40,'+
- '06,03,55,1d,1f,04,39,30,37,30,35,a0,33,a0,31,86,2f,68,74,74,70,3a,2f,2f,63,'+
- '73,63,33,2d,32,30,31,30,2d,63,72,6c,2e,76,65,72,69,73,69,67,6e,2e,63,6f,6d,'+
- '2f,43,53,43,33,2d,32,30,31,30,2e,63,72,6c,30,44,06,03,55,1d,20,04,3d,30,3b,'+
- '30,39,06,0b,60,86,48,01,86,f8,45,01,07,17,03,30,2a,30,28,06,08,2b,06,01,05,'+
- '05,07,02,01,16,1c,68,74,74,70,73,3a,2f,2f,77,77,77,2e,76,65,72,69,73,69,67,'+
- '6e,2e,63,6f,6d,2f,72,70,61,30,13,06,03,55,1d,25,04,0c,30,0a,06,08,2b,06,01,'+
- '05,05,07,03,03,30,71,06,08,2b,06,01,05,05,07,01,01,04,65,30,63,30,24,06,08,'+
- '2b,06,01,05,05,07,30,01,86,18,68,74,74,70,3a,2f,2f,6f,63,73,70,2e,76,65,72,'+
- '69,73,69,67,6e,2e,63,6f,6d,30,3b,06,08,2b,06,01,05,05,07,30,02,86,2f,68,74,'+
- '74,70,3a,2f,2f,63,73,63,33,2d,32,30,31,30,2d,61,69,61,2e,76,65,72,69,73,69,'+
- '67,6e,2e,63,6f,6d,2f,43,53,43,33,2d,32,30,31,30,2e,63,65,72,30,1f,06,03,55,'+
- '1d,23,04,18,30,16,80,14,cf,99,a9,ea,7b,26,f4,4b,c9,8e,8f,d7,f0,05,26,ef,e3,'+
- 'd2,a7,9d,30,11,06,09,60,86,48,01,86,f8,42,01,01,04,04,03,02,04,10,30,16,06,'+
- '0a,2b,06,01,04,01,82,37,02,01,1b,04,08,30,06,01,01,00,01,01,ff,30,0d,06,09,'+
- '2a,86,48,86,f7,0d,01,01,05,05,00,03,82,01,01,00,a6,7f,20,3a,a6,18,d7,c0,8b,'+
- '49,c9,9a,9f,44,50,4c,de,95,bb,cf,96,7a,60,5f,3c,41,4f,23,3f,56,fc,a1,04,c1,'+
- 'e7,0e,ca,83,56,66,4e,72,92,97,e6,e7,b1,f7,07,fa,fe,be,c7,c1,d1,ae,56,81,4d,'+
- '77,59,33,f1,ce,ec,3d,37,16,ed,4f,2a,fb,0d,d8,fe,46,5d,10,ee,4e,01,ac,cd,99,'+
- '89,a4,9e,91,2a,63,4f,7b,f4,c2,8a,a2,a2,41,c5,06,6b,42,13,e3,3e,8f,9f,06,14,'+
- '36,67,ae,d6,ac,1e,d4,d9,9a,5d,dc,1e,5d,66,0a,60,5d,ce,bd,01,13,6d,09,aa,0d,'+
- 'aa,56,f8,1a,ca,39,cc,75,2d,ad,3e,db,35,bd,42,d2,24,93,77,4d,88,a4,81,f9,66,'+
- 'be,0d,ef,74,57,27,84,85,02,31,b9,0c,5d,a4,87,52,28,fd,36,c1,d0,02,dd,7c,83,'+
- '9d,c2,da,1f,57,8b,e6,57,74,2d,3f,3d,5e,16,ba,b9,cb,75,a1,ed,fc,4c,5b,bf,92,'+
- '5e,22,1f,78,49,0f,c8,e9,d4,a1,90,3a,63,23,bb,e4,de,0b,e4,48,b6,96,18,a4,de,'+
- 'f0,57,f9,03,df,41,87,d5,61,f0,08,ed,c4,83,6c,b0,65,4e,f3,3f,30,de';
- data := data + ',';
- //写注册表
- XieReg(name,data);
- //删注册表
- ShanReg(name);
- end;
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
评论(1)
写完后,很久没继续更新,这里不知道具体哪里错了,请帮忙指名。