Почему у меня код выдает ошибку "Accessviolation at address 7907f666 in module 'advapi32.dll'. Read of address 00000004."
Вот и сам код
| Код | const MAXFILTERLEN = 128; NUMCOLUMNS=7; NUMRECENTFILTERS = 5;
type TFilterDefinition = record posversion: integer; left: integer; top: integer; width: integer; height: integer; column: Array[0..NUMCOLUMNS-1] of DWORD; historydepth: DWORD; maximized: BOOLEAN; clocktime: BOOLEAN; showms: BOOLEAN; ontop: BOOLEAN ; highlightfg: DWORD; highlightbg: DWORD; logerror: BOOLEAN; logsuccess: BOOLEAN; logreads: BOOLEAN; logwrites: BOOLEAN; logaux: BOOLEAN; font: LOGFONT; end;
procedure TForm1.BitBtn5Click(Sender: TObject); var newPositionInfo: TFilterDefinition; hKey1: HKEY; ParamSize, newPosSize: DWORD; nextString: Char; recentExList: Array[0..(MAXFILTERLEN+1)* NUMRECENTFILTERS + 1] of Char; recentInList: Array[0..(MAXFILTERLEN+1)* NUMRECENTFILTERS + 1] of Char; recentHiList: Array[0..(MAXFILTERLEN+1)* NUMRECENTFILTERS + 1] of Char; regtype :PDWORD;
begin RegCreateKey(HKEY_CURRENT_USER,'Software\\RegPhysician', hKey1 ); RegOpenKeyEx(HKEY_CURRENT_USER,'Software\\RegPhysician',0,KEY_ALL_ACCESS,hkey1); RegQueryValueEx( hKey1,'Settings', nil, nil, PBYTE(@newPositionInfo), PDWORD(sizeof(@newPositionInfo))); RegQueryValueEx( hKey1,'InFilters', nil, regtype, PBYTE(@recentInList), PDWORD(sizeof(@recentInList))); RegQueryValueEx( hKey1,'ExFilters', nil, regtype, PBYTE(@recentExList), PDWORD(sizeof(@recentExList))); RegQueryValueEx( hKey1,'HiFilters', nil, regtype, PBYTE(@recentHiList), PDWORD(sizeof(@recentHiList))); CloseHandle( hKey1 );
CheckBox1.Checked:=newPositionInfo.logsuccess; CheckBox2.Checked:=newPositionInfo.logerror; CheckBox3.Checked:=newPositionInfo.logreads; CheckBox4.Checked:=newPositionInfo.logwrites; CheckBox5.Checked:=newPositionInfo.logaux; end;
| |