You are here:

C++/Protecting a file from beeing read ...


Hello sir,

I have developed a client-server application. The server sends an AVI file to the client. The client stores this avi file in some temporary folder and when completely downloaded, plays it. And when the avi finishes, the client deletes it.

My problem is that while the avi is played, it can be copied. I know I can use ICopyHook to control over the copy operation; But an intruder can read my avi file using another program that he himself has developed, while it(the AVI) is beeing played back.

What can I do in order to protect my AVI file from beeing stolen(copied or read)?

Can I play the avi without temporarily storing on the disk?

thank you very very much.

(At the time of writing - Monday 11th October 2004 - I do not know when I can post this answer to you as the AllExperts site has been returning a "Server Too Busy" error to me for the last three days. I have now posted an email to their support but I am not holding my breath!)

Well I can think of a couple of ways:

You could try playing with user accounts, access control lists and running processes under separate accounts / security identities.

You could scramble the AVI files so that only your decoder can decode them. I did this some years ago for a CD-ROM based application in a very simple manner using what was then ActiveMovie by writing a special ActiveMovie filter that descrambled the raw AVI byte stream before it was passed to the decoder filter. A simple command line (i.e. usable from a batch file!) utility scrambled the AVI files.

However more to the point of your final request, I remember that ActiveMovie - now DirectShow - had an alternative file source filter to the usual file-based ASync file source filter called the File Source (URL) Filter which works with any source that can be identified by a URL which may be worth investigating - I do not know how it buffers data though. If this is no good then I suppose you could develop you own file source filter.

The downside of writing your own DirectShow filters is that you have to also create you own filter graphs - the filters and the links between them that actually allow the playing of your media. The DirectShow SDK documentation can be located online in the MSDN library at under Win32 and COM Development / Graphics and Multimedia / DirectX / SDK Documentation.

It seems however that to get good video streaming support you need to also look at the Windows Media Format SDK and maybe the likes of the DirectShow WM ASF Reader and Writer Filters. See the MSDN Library path Win32 and COM Development / Graphics and Multimedia / Audio and Video / SDK Documentation for more information.

Another possible, though I think probably a less useful option, is the MS BDA - Broadcast Driver Architecture for digital TV part of DirectShow. However I think that it may be a little extreme for your needs as you appear to require a BDA compatible digital TV tuner! Seems to be of more use for set top boxes and the like.  


All Answers

Answers by Expert:

Ask Experts


Ralph McArdell


I am a software developer with more than 15 years C++ experience and over 25 years experience developing a wide variety of applications for Windows NT/2000/XP, UNIX, Linux and other platforms. I can help with basic to advanced C++, C (although I do not write just-C much if at all these days so maybe ask in the C section about purely C matters), software development and many platform specific and system development problems.


My career started in the mid 1980s working as a batch process operator for the now defunct Inner London Education Authority, working on Prime mini computers. I then moved into the role of Programmer / Analyst, also on the Primes, then into technical support and finally into the micro computing section, using a variety of 16 and 8 bit machines. Following the demise of the ILEA I worked for a small company, now gone, called Hodos. I worked on a part task train simulator using C and the Intel DVI (Digital Video Interactive) - the hardware based predecessor to Indeo. Other projects included a CGI based train simulator (different goals to the first), and various other projects in C and Visual Basic (er, version 1 that is). When Hodos went into receivership I went freelance and finally managed to start working in C++. I initially had contracts working on train simulators (surprise) and multimedia - I worked on many of the Dorling Kindersley CD-ROM titles and wrote the screensaver games for the Wallace and Gromit Cracking Animator CD. My more recent contracts have been more traditionally IT based, working predominately in C++ on MS Windows NT, 2000. XP, Linux and UN*X. These projects have had wide ranging additional skill sets including system analysis and design, databases and SQL in various guises, C#, client server and remoting, cross porting applications between platforms and various client development processes. I have an interest in the development of the C++ core language and libraries and try to keep up with at least some of the papers on the ISO C++ Standard Committee site at


©2017 All rights reserved.