Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 422
  • Last Modified:

File creation time

Hi,

I'm try to figure out what the exact creation time of a file is. I've used

GetFileTime()

which will give me the time Windows thinks the file was created. But I need the absolute time it was created. For example, if I create a txt file on one computer, then send it to another computer, and use GetFileTime() on it, what will be returned is the time that it was made on the end user's machine, not the time it was created at the original computer.

Is it possible to get this information? I need it to check if a file I'm examining is the original file or just a copy.

Thanks
0
ragin_cajun
Asked:
ragin_cajun
  • 5
  • 4
1 Solution
 
AndyAinscowFreelance programmer / ConsultantCommented:
I don't think you can get that information.
Can you write into the file itself a date/time stamp?
If you want to see if it has been modified you need to check other information and create a checksum for the file.
0
 
ragin_cajunAuthor Commented:
Andy,

If I embed a time stamp into the file - the time stamp will be copied over as well...

If I do a checksum on the original file, then a checksum on the copy, they should both return the same result as their contents haven't been modified, is this correct?

Thanks
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
If I embed a time stamp into the file - the time stamp will be copied over as well...

I don't know what happens to the file.  If the file is being modified by your app then the time stamp will match the create on the original BUT not the copy.



If I do a checksum on the original file, then a checksum on the copy, they should both return the same result as their contents haven't been modified, is this correct?


It ought to return the same.  Any change should alter the check sum.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
ragin_cajunAuthor Commented:
yeah that's the problem - the copying is done by the user with the OS (windows) - so I have no way to embed anything in the file when they choose to copy it through the OS..
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
Are you wanting to check if it has been modified? Yes - I think you will require a checksum.  No - exactly what is behind this requirement of the creation date?
0
 
ragin_cajunAuthor Commented:
Hi Andy,

Here's my problem - I have some license software that generates a key file - the key has an encrypted file coupled to it that keeps track of how many times the user has used my product.

What I'm worried about is that someone can simply copy the file that keeps track of # of uses when first installed on their machine, ie. at zero uses. When expiration has been reached, they can simply replace the original with the copy.

This is why I need to make sure the file is the original and not a copy...
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
I thought it might be about limiting time of use in demo version.

What you are attempting to do (I am just being objective, no offence intended) seems to be quite a simple protection system and as you have noticed has a quite obvious hole in it.

Am I correct that it can be used say 20 times (not date limited, just usage).

One way around this could be you do not have the file on your original CD, it is created as part of the installation and at that time a date is written into this encrypted file.  At the same time a date is written into the registry.
Each time your program starts it can then check the date in the file AND the date in the registry, if they match both are updated with the current date.  So if someone copies this file then at a later date relaces the 'expired' one then the dates don't match any more.
You would still have to cope with someone de-installing and re-installing.
That would be a bit more robust but still open to someone monitoring the registry.

I use at times a secured Access database and check for other things as well.  (I'm not going to divulge everything I do for obvious reasons).

Practically everything you can think of could be circumvented, it's a question of how much you want to do and how determined you think the end users will be in wanting to crack your security.
0
 
ragin_cajunAuthor Commented:
It is indeed very simplistic no offense taken. It does seem that anything I can think of can be circumvented - such as storing info in the registry or a hidden file - they can always be monitored for changes..

I think I will have to do a large combination of many practices simply to make the process of fooling the security a pain in the ass.

Thanks for your input Andy.
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
I do at least 2 independant things for a cross check.  At a minimum it makes it ***** awkward for the end-user to restore things to a clean state.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now