?
Solved

File creation time

Posted on 2004-03-20
9
Medium Priority
?
411 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
0
Comment
Question by:ragin_cajun
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 10643616
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
 
LVL 1

Author Comment

by:ragin_cajun
ID: 10644926
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
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 10644991
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
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 
LVL 1

Author Comment

by:ragin_cajun
ID: 10645024
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
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 10646991
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
 
LVL 1

Author Comment

by:ragin_cajun
ID: 10649628
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
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 860 total points
ID: 10649845
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
 
LVL 1

Author Comment

by:ragin_cajun
ID: 10649971
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
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 10650214
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

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question