[fpc-pascal]v1.0.10 w32 release TRegistry.KeyExists function broken?

2003-07-13 Thread Ronald Fox
I'm very happy to see a working Registry unit for win32 in the
latest release.  I can't get the KeyExists function to work as
I imagine it should, though.  I would expect that KeyExists
should test for the presence of a relative or absolute key in the
registry.  Instead, it seems to return false for any supplied key
until there is a successful OpenKey on any key, then it will return
true for any key, even non-existant keys.

On an unrelated note, should the 2 Hints that appear in the compiler
output be showing up?  They didn't in my v1.0.6 install.

Thanks to all who work so tirelessly on this project, your efforts
are greatly appreciated.

Regards,
Ron
--
program regquery;

uses
  Registry;

var
  myTRO: TRegistry;
  myKeyInfo: TRegKeyInfo;
  myKey: String;

begin

myTRO := TRegistry.Create;
myTRO.RootKey := HKEY_CURRENT_USER;
repeat
  write('Enter Key: ');
  readln(myKey);
  if myKey <> ''
then
  begin
  if myTRO.KeyExists(myKey)
then writeln('Key exists.')
else writeln('Key doesn''t exist.');

  if myTRO.OpenKey(myKey,False)
then
  begin
  if myTRO.GetKeyInfo(myKeyInfo)
then
  begin
  writeln('NumSubKeys: ',myKeyInfo.NumSubKeys);
  writeln('NumValues : ',myKeyInfo.NumValues);
  end;
  end
else writeln('Can''t open key.');
  writeln;
  end;

until myKey = '';

myTRO.Free;
end.

---
Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.

C:\>cd my-fpc\testing\registry

C:\my-fpc\testing\registry>ppc386 regquery.pp
Hint: End of reading config file c:\pp\bin\win32\fpc.cfg
Free Pascal Compiler version 1.0.10 [2003/06/27] for i386
Copyright (c) 1993-2003 by Florian Klaempfl
Target OS: Win32 for i386
Compiling regquery.pp
syswin32.pp(3,1) Hint: Conditional I386 was set at startup in last compilation of 
syswin32.pp
Linking regquery.exe
42 Lines compiled, 4.2 sec

C:\my-fpc\testing\registry>regquery.exe
Enter Key: nada
Key doesn't exist.
Can't open key.

Enter Key: nada
Key doesn't exist.
Can't open key.

Enter Key: \Software
Key doesn't exist.
NumSubKeys: 16
NumValues : 0

Enter Key: \Software
Key exists.
NumSubKeys: 16
NumValues : 0

Enter Key: nada
Key exists.
Can't open key.

Enter Key: nada
Key exists.
Can't open key.

Enter Key: \Software
Key exists.
NumSubKeys: 16
NumValues : 0

Enter Key: \nada
Key exists.
Can't open key.

Enter Key:

C:\my-fpc\testing\registry>
-- 
Ronald FoxEmail: [EMAIL PROTECTED]
Diagnostic Laboratory Services, Inc.  Phone: (808) 589-5172
Honolulu, Hawaii


___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal]v1.0.10 w32 release Eventlog resource not found

2003-07-13 Thread Ronald Fox
A significant enhancement found in the win32 release is the
EventLog unit.  I had a little trouble with compiling the
example program tstelcmd.pp because the linker couldn't
find a required resource file.  After finding the missing
file (fclel.res) in c:\pp\source\fcl\win32\ and copying it
to my source directory the program compiled (and ran) just
fine.

Is there a search path for resources or how should this be
properly fixed?

Regards,
Ron
-
{$mode objfpc}
{$h+}
{$ifdef win32}
{$r fclel.res}
{$endif}

program testelcmd;

uses eventlog;

Var
  E : TEventType;

begin
  With TEventLog.Create(Nil) do
Try
  Identification:='Test eventlog class';
  RegisterMessageFile('');
  Active:=True;
  For E:=etInfo to etDebug do
Log(E,'An event log message of type '+EventTypeToString(E));
finally
  Free;  
end;
end.
-
C:\> set path
Path=C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;c:\pp\bin\win32;c:\util

C:\> cd my-fpc\testing\eventlog
C:\my-fpc\testing\eventlog>ppc386 tstelcmd.pp
Hint: End of reading config file c:\pp\bin\win32\fpc.cfg
Free Pascal Compiler version 1.0.10 [2003/06/27] for i386
Copyright (c) 1993-2003 by Florian Klaempfl
Target OS: Win32 for i386
Compiling tstelcmd.pp
syswin32.pp(9,1) Hint: Conditional I386 was set at startup in last compilation of 
syswin32.pp
Compiling resource fclel.res
c:\pp\bin\win32\windres.exe: can't open `fclel.res' for output: No such file or 
directory
tstelcmd.pp(25,1) Error: Error while linking
tstelcmd.pp(25,1) Fatal: There were 1 errors compiling module, stopping
Closing script ppas.bat

C:\my-fpc\testing\eventlog>
-- 
Ronald FoxEmail: [EMAIL PROTECTED]
Diagnostic Laboratory Services, Inc.  Phone: (808) 589-5172
Honolulu, Hawaii



___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]v1.0.10 w32 release Eventlog resource not found

2003-07-14 Thread Ronald Fox
On Mon, 14 Jul 2003, Michael Van Canneyt wrote:
> > Is there a search path for resources or how should this be
> > properly fixed?
> 
> The .res file should be put next to the installed .ppu file.
> To fix it, you can simply copy it there, but it is an error in the
> distribution files. (and in the Make install target)

c:> dir /s c:\pp\*.ppu doesn't find any files but there is a
c:\pp\units\win32\fcl\eventlog.ppw, so I copied fclel.res from
c:\pp\source\fcl\win32 to c:\pp\units\win32\fcl, removed fclel.res
from my source directory and recompiled.  Same output as before:

C:\my-fpc\testing\eventlog>ppc386 tstelcmd.pp
Hint: End of reading config file c:\pp\bin\win32\fpc.cfg
Free Pascal Compiler version 1.0.10 [2003/06/27] for i386
Copyright (c) 1993-2003 by Florian Klaempfl
Target OS: Win32 for i386
Compiling tstelcmd.pp
syswin32.pp(9,1) Hint: Conditional I386 was set at startup in last compilation of 
syswin32.pp
Compiling resource fclel.res
c:\pp\bin\win32\windres.exe: can't open `fclel.res' for output: No such file or 
directory
tstelcmd.pp(25,1) Error: Error while linking
tstelcmd.pp(25,1) Fatal: There were 1 errors compiling module, stopping
Closing script ppas.bat

Mahalo,
Ron





___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal