Solved

File creation time

Posted on 2004-03-20
9
407 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 215 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

734 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