GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 08-May-2006, 08:31
itch itch is offline
New Member
 
Join Date: Apr 2006
Posts: 26
itch is on a distinguished road

Thread


I wrote a program that does the following:

My program spawns thread A and thread B. Thread A monitors thread B. Thread B runs another program called word.exe. I want Thread B to notify thread A, or thread A to realise when word.exe tries to open a .doc file. The .doc files in a specific folder are protected. I want to unprotect them when word.exe wants access to them.

Does that make sense? Any idea as to how to notify thread A or thread B that word.exe is now requesting access to these files?
  #2  
Old 08-May-2006, 11:36
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,243
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all

Re: Thread


Not really. The only way this could be done is if Word.exe notifies you it's opening a file. AFAIK, it doesn't.
__________________

Age is unimportant -- except in cheese
  #3  
Old 08-May-2006, 12:30
kobi_hikri's Avatar
kobi_hikri kobi_hikri is offline
Regular Member
 
Join Date: Apr 2005
Location: Israel
Posts: 431
kobi_hikri has a spectacular aura aboutkobi_hikri has a spectacular aura about

Re: Thread


Quote:
Originally Posted by itch
I wrote a program that does the following:

My program spawns thread A and thread B. Thread A monitors thread B. Thread B runs another program called word.exe. I want Thread B to notify thread A, or thread A to realise when word.exe tries to open a .doc file. The .doc files in a specific folder are protected. I want to unprotect them when word.exe wants access to them.

This is a most interesting question, regardless of the answer to "Word notifies you" issue.

So:
1. You have thread A that monitors thread B.
2. You have an application, C.
3. You have a protected resource (one resource for simplicity), D.

You want a user to use resource D with application C only if the request came from thread B. That's why you need another thread - A, which basically only tells you if the call to open D with C is permitted.


Am I correct ?
__________________
It's actually a one time thing (it just happens alot).
  #4  
Old 09-May-2006, 02:59
itch itch is offline
New Member
 
Join Date: Apr 2006
Posts: 26
itch is on a distinguished road

Re: Thread


> You want a user to use resource D with application C only if the request came from thread B.
> That's why you need another thread - A, which basically only tells you if the call to open D with
> C is permitted.
> Am I correct ?

Yip. You are. I dont think a monitor thread is necessary, but it might simplify things if you dedicate one thread to monitoring resources and unlocking them as required. I just basically need a way to notify thread A/B that Word.exe needs to open a certain file, so that I can unlock it. Basically when a request comes for file Z from word.exe, my thread must check to see if file Z is locked. If that is the case, it must be unlocked ONLY if word.exe is the requesting app.

How on earth can I do this?

--------------

More info:

The problem is this. I have to write a copyright proggy that stops users from copying map files. These map files must be locked but still accesible in the sense that the user can click on File --> Open and then select the file. There is no way I can load these files into memory and show them to the user or something weird like that, because at the end of the day, the user will HAVE to scroll to the folder where the files are. I really cant think of any other way to help protect the map files. The main reason for this is because I am writing a program for a 3rd party app (called word.exe...). If I had the source for word.exe... I could somehow embed the files INSIDE the program. But alas, I do not!
  #5  
Old 09-May-2006, 13:41
kobi_hikri's Avatar
kobi_hikri kobi_hikri is offline
Regular Member
 
Join Date: Apr 2005
Location: Israel
Posts: 431
kobi_hikri has a spectacular aura aboutkobi_hikri has a spectacular aura about

Re: Thread


So, The only way I can help you is by suggesting:

1. Lock the files with any mechanism you know as good (even consider using simple tools that requests for password to open the file).

2. Have the key to open those files only in one place (Like the File->Open menu).

The other options that come into (my) mind are much complicated:
1. Monitor service (Thread).
2. Building your own Lock / Unlock mechanism (not simple at all !).
__________________
It's actually a one time thing (it just happens alot).
  #6  
Old 10-May-2006, 00:56
itch itch is offline
New Member
 
Join Date: Apr 2006
Posts: 26
itch is on a distinguished road

Re: Thread


1. Wont work because the people will then be able to copy the files to other PCs.

I just need a way to get a signal from word.exe that word.exe actually wants to open a file. And which one. is there any way to do that?!?
  #7  
Old 10-May-2006, 14:35
kobi_hikri's Avatar
kobi_hikri kobi_hikri is offline
Regular Member
 
Join Date: Apr 2005
Location: Israel
Posts: 431
kobi_hikri has a spectacular aura aboutkobi_hikri has a spectacular aura about

Re: Thread


Quote:
Originally Posted by itch

I just need a way to get a signal from word.exe that word.exe actually wants to open a file. And which one. is there any way to do that?!?

Well, if you want to work like that, I have nothing to add to Walt's original answer.
__________________
It's actually a one time thing (it just happens alot).
  #8  
Old 10-May-2006, 15:10
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,243
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all

Re: Thread


Quote:
Originally Posted by itch
I just need a way to get a signal from word.exe ...
Then word.exe must signal you

Quote:
Originally Posted by itch
... that word.exe actually wants to open a file.
What signal does word.exe give you when it tries to open a file?

Quote:
Originally Posted by itch
... And which one.
Exactly. How does word.exe signal you and pass you the file name?

Quote:
Originally Posted by itch
is there any way to do that?!?
Rewrite word.exe.

Alternate option. Replace word.exe with a program that does all the security crap, then passes an execute command with file name to the original word.exe. IT watches for word.exe to exit and cleans up the security.

Many holes in this idea:
1) what happens after a crash.
2) the file is accessable while the original word.exe is running
just to name 2
__________________

Age is unimportant -- except in cheese
 
 

Recent GIDBlogMeeting the populace by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Monitoring Thread Size mark343 MS Visual C++ / MFC Forum 0 04-May-2006 09:09
How to protect single thread in phpBB iota MySQL / PHP Forum 0 20-Mar-2006 22:48
Sending message to GUI thread that ISNT the main thread mpviii MS Visual C++ / MFC Forum 1 20-Apr-2005 12:49
The Official Birthday Wishes thread for jrobbio JdS Open Discussion Forum 8 20-Nov-2003 18:21

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 13:53.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.