We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

File creation time

ragin_cajun
ragin_cajun asked
on
Medium Priority
464 Views
Last Modified: 2013-11-20
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
Comment
Watch Question

AndyAinscowFreelance programmer / Consultant
CERTIFIED EXPERT

Commented:
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.

Author

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
AndyAinscowFreelance programmer / Consultant
CERTIFIED EXPERT

Commented:
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.

Author

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..
AndyAinscowFreelance programmer / Consultant
CERTIFIED EXPERT

Commented:
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?

Author

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...
Freelance programmer / Consultant
CERTIFIED EXPERT
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

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.
AndyAinscowFreelance programmer / Consultant
CERTIFIED EXPERT

Commented:
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.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.