Solved

File creation time

Posted on 2004-03-20
9
403 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
  • 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

705 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now