Вниз
Скачать: CL | DM;

Ошибка при работе с RegQueryValueEx   Найти похожие ветки 

 
Alexis ©   (2004-06-12 15:37) [0]

procedure TRestrictionsForm.FormCreate(Sender: TObject);
var
OPENED : HKEY;
Buffer : Pointer;
ValType, BuffSize : DWORD;
begin
RegOpenKeyEx(HKEY_CURRENT_USER, "SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer", 0, KEY_EXECUTE, OPENED);
Buffer := nil;
if RegQueryValueEx(OPENED, "NoDrives", nil, @ValType, PByte(Buffer), @BuffSize) = ERROR_SUCCESS then
  if (ValType = REG_DWORD) or (ValType = REG_BINARY) then
   ShowMessage( IntToStr(Integer(Buffer)) );
end;

Постоянно выдается 0, даже при ненулевом значении.
Где ошибка?
Заранее спасибо.


 
Cobalt ©   (2004-06-13 13:52) [1]

А память под буфер выделять не собираетесь?


 
Cobalt ©   (2004-06-13 13:53) [2]

If the function fails, the return value is a nonzero error code defined in WINERROR.H. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to get a generic description of the error.
(GetSysError, если не ошибаюсь)



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.046 c
1-1089729567
Homyak_Max
2004-07-13 18:39
2004.07.25
Проблемы с потоками


8-1084255400
Akron
2004-05-11 10:03
2004.07.25
Добавление ani курсора в RC и использование его в EXE


3-1088581315
stelius
2004-06-30 11:41
2004.07.25
Срока в SQL


14-1088723413
Defen
2004-07-02 03:10
2004.07.25
глубиные ошибки


11-1077864777
ALeX.B.
2004-02-27 09:52
2004.07.25
ICMP из ICS реально дольше работает чем ICMP из INDY(не KOL)!




   Наверх