F
form2
Unregistered / Unconfirmed
GUEST, unregistred user!
在我电脑里存在,不知道你们如何?
问题:
单步跟踪发现,必须2次执行:
cli:=RegQueryValueExA(K,'RootDir',nil,i,eb,v);
才会在eb数组中存放数据
另外:eb因故使用byte数组,而没有使用TBytes or StringBuilder
下面附2个环境的代码:
//bug.vcl.forms.app
procedure TForm1.Button1Click(Sender: TObject);
var
K:HKEY;
v,i:dword;
b,cli:longint;
eb:Array[0..100] of byte;
begin
b:=RegOpenKeyEx(HKEY_LOCAL_MACHINE,'SOFTWARE/Borland/BDS/2.0/',0,KEY_READ,K);
cli:=RegQueryValueExA(K,'RootDir',nil,i,eb,v);
cli:=RegQueryValueExA(K,'RootDir',nil,i,eb,v);
if(b=0)and(cli=0)and(eb[1]<>0)then
begin
self.Caption:=string(eb);
end;
end;
//bug.windows.forms.app
procedure TWinForm.Button1_Click(sender: System.Object;
e: System.EventArgs);
var
K:HKEY;
v,i:dword;
b,cli:longint;
eb:Array[0..100] of byte;
begin
b:=RegOpenKeyEx(HKEY_LOCAL_MACHINE,'SOFTWARE/Borland/BDS/2.0/',0,KEY_READ,K);
cli:=RegQueryValueExA(K,'RootDir',nil,i,eb,v);
cli:=RegQueryValueExA(K,'RootDir',nil,i,eb,v);
if(b=0)and(cli=0)and(eb[1]<>0)then
begin
self.text:=string(eb);
end;
end;
问题:
单步跟踪发现,必须2次执行:
cli:=RegQueryValueExA(K,'RootDir',nil,i,eb,v);
才会在eb数组中存放数据
另外:eb因故使用byte数组,而没有使用TBytes or StringBuilder
下面附2个环境的代码:
//bug.vcl.forms.app
procedure TForm1.Button1Click(Sender: TObject);
var
K:HKEY;
v,i:dword;
b,cli:longint;
eb:Array[0..100] of byte;
begin
b:=RegOpenKeyEx(HKEY_LOCAL_MACHINE,'SOFTWARE/Borland/BDS/2.0/',0,KEY_READ,K);
cli:=RegQueryValueExA(K,'RootDir',nil,i,eb,v);
cli:=RegQueryValueExA(K,'RootDir',nil,i,eb,v);
if(b=0)and(cli=0)and(eb[1]<>0)then
begin
self.Caption:=string(eb);
end;
end;
//bug.windows.forms.app
procedure TWinForm.Button1_Click(sender: System.Object;
e: System.EventArgs);
var
K:HKEY;
v,i:dword;
b,cli:longint;
eb:Array[0..100] of byte;
begin
b:=RegOpenKeyEx(HKEY_LOCAL_MACHINE,'SOFTWARE/Borland/BDS/2.0/',0,KEY_READ,K);
cli:=RegQueryValueExA(K,'RootDir',nil,i,eb,v);
cli:=RegQueryValueExA(K,'RootDir',nil,i,eb,v);
if(b=0)and(cli=0)and(eb[1]<>0)then
begin
self.text:=string(eb);
end;
end;