473,395 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Read-only access to FAT32/NTFS files w/ write locks?

Hello,

In my application that I'm writing in C++ (and maybe Java),
specifically the cygwin flavor of C++, I want to be able to open any
existing files in FAT32 or NTFS file systems (in Windows XP) for
read-only purposes. In particular, I want my program to
unconditionally be able to read-only open any file--and be able to
read all the contents from said fail--which has been marked with any
sort of "exclusionary" lock, including write locks or any other kind
of locks.

Is this possible? Are there any "exclusionary" locks or scenarios
where in WinXP (with either FAT32 or NTFS files) that might prevent
another process from opening a file in read-only mode?

The only case I have experience: using cygwin to unset all file
permissions (including the "read" bit(s)) in an NTFS file system, in
which case non-Administrator processes (presumably) will not be able
to read the file.

Thanks for any help,
-Matt

--
Remove the "downwithspammers-" text to email me.
Jul 23 '05 #1
2 3000
Snapshots help a lot.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
ma***@storagecraft.com
http://www.storagecraft.com

"Matt" <ma**@downwithspammers-mengland.net> wrote in message
news:6b********************************@4ax.com...
Hello,

In my application that I'm writing in C++ (and maybe Java),
specifically the cygwin flavor of C++, I want to be able to open any
existing files in FAT32 or NTFS file systems (in Windows XP) for
read-only purposes. In particular, I want my program to
unconditionally be able to read-only open any file--and be able to
read all the contents from said fail--which has been marked with any
sort of "exclusionary" lock, including write locks or any other kind
of locks.

Is this possible? Are there any "exclusionary" locks or scenarios
where in WinXP (with either FAT32 or NTFS files) that might prevent
another process from opening a file in read-only mode?

The only case I have experience: using cygwin to unset all file
permissions (including the "read" bit(s)) in an NTFS file system, in
which case non-Administrator processes (presumably) will not be able
to read the file.

Thanks for any help,
-Matt

--
Remove the "downwithspammers-" text to email me.

Jul 23 '05 #2
Matt wrote:
[a Windows-specific question]

This is off-topic for clc++. Followups set.

Kristo

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Gunnar | last post by:
Hello, I've just written a CPP program that reads integers from a binary file, and used this code while (my_ifstram.read( (char* ) &number, sizeof(int)) { // do something with number } My...
6
by: Steve | last post by:
Hi, I'm trying to convert a file reading loop into one using streams. The BSD OS read API returns the number of bytes read, but istream::read returns itself. How can I find out the number of...
12
by: Steven T. Hatton | last post by:
I know of a least one person who believes std::ifstream::read() and std::ofstream::write() are "mistakes". They seem to do the job I want done. What's wrong with them. This is the code I...
2
by: Sandman | last post by:
Just looking for suggestion on how to do this in my Web application. The goal is to keep track of what a user has and hasn't read and present him or her with new material I am currently doing...
4
by: Andreas Müller | last post by:
Hi, I'm working on a Linux-programm with a signal-handler and therfore I need to use the read-system-call instead of cin.get or sth. like that. With getline my program works fine, it reads a...
4
by: Ollie Cook | last post by:
Hi, I am having some difficulty with read(2) and interrupting signals. I expect I am misunderstanding how the two work together, so would appreciate some guidance. I am trying to 'time out' a...
9
by: ferbar | last post by:
Hi all, I'm trying to read from the txt file 'ip.packets.2.txt' using the read function. It seems everything ok, but I get a -1 when executing >>bytesr = read(fdo1, bufread, 2); The 'open'...
8
by: S Shulman | last post by:
Hi All I need to read a file to an array of bytes (any type of file) I tried using FileStream and BinaryReader but it doesn't seem to work Thank you, Shmuel
3
by: Ole | last post by:
I got a problem with serial port read which I use like this: sp.Read (byteBuffer, 0, 100); but the problem is that it returns before it has read the 100 bytes - is there a way to set up the...
0
by: phplasma | last post by:
Hey, I am currently attempting to implement a multi-threaded C# socket, using SSL (.pem file/certification/private key combo) server using Visual Studio C# Express. I have successfully made...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.