Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2001-05

RE: w2000 file opening - was dos approx delay fn that releases cpu

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author
I was told to use filemode=0... but it didn't make any difference! What are exactly are useful values for filemode & what does each do? NB Not in documentation? eg as part of reset info?
filemode:=0 is okay for DOS programs, but not necessarily so for Win32
programs. I had a similar problem before and filemode:=$40 seemed to cure a
lot of the "access denied" errors I was getting with a filefind utility I
wrote. Perhaps that's the only problem with your program as well.

I wish I could be more help about the rest of the filemode settings for Win32, but unfortunately I don't recall where I got that info from. Sorry.

Jim

Reply by email

Gabor DEAK JAHN
to Unknown author

At 5/9/01 02:30 PM, you wrote:

Jim

I wish I could be more help about the rest of the filemode settings for Win32, but unfortunately I don't recall where I got that info from. Sorry.

From the file Win32.inc:

    fmShareCompat    = $00000000;
    fmShareExclusive = $10;
    fmShareDenyWrite = $20;
    fmShareDenyRead  = $30;
    fmShareDenyNone  = $40;

If you check out Syswin32.pp from the RTL source (procedure Do_Open), you'll see that the single Filemode value passed on by routines like Reset or Rewrite will not be used directly but dissected into several flags and then fed to the appropriate Win32 routines. I didn't check if every possible value and flag is handled by the FPC RTL or not, but you can always call the Win32 file I/O functions directly, providing whatever flag you want. The MSDN documentation of CreateFile has a description of all flags accepted by Win32.

Bye,
Gábor

------------------------------------------------------------------- Gabor DEAK JAHN -- Budapest, Hungary.
E-mail:

Reply by email