Board index » delphi » ACCESS DENIED trying to open a CDROM file, ONLY under NT, W95/8 fine

ACCESS DENIED trying to open a CDROM file, ONLY under NT, W95/8 fine

OK, what am I missing... noting that this same code works fine under
win95/98...

...
  var
  BLOBfile: file;
...
  assignfile(BLOBfile,CDROMblobFileName);
  reset(BLOBfile,1);         <===     Acess Denied when executed

  blockread(BLOBfile,.....)
  etc,

When the CDROMblobFileName points to a hard disk copy of the blob, the
code works, under nt or win9x. When CDROMblobFileName points to the
same file on CDROM, under w9x it continues to work fine; but under NT,
either 3.51sp3, sp4 or 4.0: Access Denied. Could this be a collision
btwn the D2 library trying to open the file inout and NT saying thats
not possible (where w9x just ignores it)? if so: how does one open the
file strictly for read, or at least how does one tell NT such?

many thanks,
=greg

 

Re:ACCESS DENIED trying to open a CDROM file, ONLY under NT, W95/8 fine


Quote
greg mushial wrote:

> OK, what am I missing... noting that this same code works fine under
> win95/98...

> ...
>   var
>   BLOBfile: file;
> ...
>   assignfile(BLOBfile,CDROMblobFileName);
>   reset(BLOBfile,1);         <===     Acess Denied when executed

>   blockread(BLOBfile,.....)
>   etc,

> When the CDROMblobFileName points to a hard disk copy of the blob, the
> code works, under nt or win9x. When CDROMblobFileName points to the
> same file on CDROM, under w9x it continues to work fine; but under NT,
> either 3.51sp3, sp4 or 4.0: Access Denied. Could this be a collision
> btwn the D2 library trying to open the file inout and NT saying thats
> not possible (where w9x just ignores it)? if so: how does one open the
> file strictly for read, or at least how does one tell NT such?

I am not a Delphi expert, but it must have to do with the
fact that a CD is R/O. On Turbo Pascal there is a "FileMode"
variable to handle that, it must be set to 0 for R/O access.

  FileMode := 0;
  Reset(....,1);

Regards, Franz Glaser

Re:ACCESS DENIED trying to open a CDROM file, ONLY under NT, W95/8 fine


Ing. Franz Glaser <meg-gla...@eunet.at> wrote:

Quote
> greg mushial wrote:

>> OK, what am I missing... noting that this same code works fine under
>> win95/98...

>> ...
>>   var
>>   BLOBfile: file;
>> ...
>>   assignfile(BLOBfile,CDROMblobFileName);
>>   reset(BLOBfile,1);         <===     Acess Denied when executed

>>   blockread(BLOBfile,.....)
>>   etc,

>> When the CDROMblobFileName points to a hard disk copy of the blob, the
>> code works, under nt or win9x. When CDROMblobFileName points to the
>> same file on CDROM, under w9x it continues to work fine; but under NT,
>> either 3.51sp3, sp4 or 4.0: Access Denied. Could this be a collision
>> btwn the D2 library trying to open the file inout and NT saying thats
>> not possible (where w9x just ignores it)? if so: how does one open the
>> file strictly for read, or at least how does one tell NT such?
> I am not a Delphi expert, but it must have to do with the
> fact that a CD is R/O. On Turbo Pascal there is a "FileMode"
> variable to handle that, it must be set to 0 for R/O access.

I think the OpenFile api call has the possibility to set it to readonly,
look for the function in the win32.hlp

HTH

  Roel

Re:ACCESS DENIED trying to open a CDROM file, ONLY under NT, W95/8 fine


Quote
greg mushial wrote:
> OK, what am I missing... noting that this same code works fine under
> win95/98...

> ...
>   var
>   BLOBfile: file;
> ...
>   assignfile(BLOBfile,CDROMblobFileName);
>   reset(BLOBfile,1);         <===     Acess Denied when executed

>   blockread(BLOBfile,.....)
>   etc,

> When the CDROMblobFileName points to a hard disk copy of the blob, the
> code works, under nt or win9x. When CDROMblobFileName points to the
> same file on CDROM, under w9x it continues to work fine; but under NT,
> either 3.51sp3, sp4 or 4.0: Access Denied. Could this be a collision
> btwn the D2 library trying to open the file inout and NT saying thats
> not possible (where w9x just ignores it)? if so: how does one open the
> file strictly for read, or at least how does one tell NT such?

  Any file type, other than TEXT, opens in read/write mode by default.
Since CD-Rom's are typically read-only, you get an error. The same thing
would happen for any file marked as Read Only. You need to set the
FileMode before issuing the Reset. Search the Help system for the
necessary numbers.

--
If there is a no_junk in my address, please REMOVE it before replying!
All junk mail senders will be prosecuted to the fullest extent of the
law!!
http://www.ntsource.com/~andyross

Re:ACCESS DENIED trying to open a CDROM file, ONLY under NT, W95/8 fine


On Sun, 03 Jan 1999 21:46:26 GMT, gmush...@gmdr.com (greg mushial)
wrote:

To all those who e-mailed me: thanks; to those who posted followups,
thanks - the problem was resolved by adding a FileMode:= 0 before the
Reset.

thanks again,

=greg

Other Threads