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
Solved

System Trap

Posted on 1998-09-21
4
247 Views
Last Modified: 2010-04-15
Hi,
   I am currently involved in the developing a Y2K tool .The one of important feature of this tool is it wont use any of the source code. It will use the data to give remedation and aging in runtime. So I would like to know whether we can trap a system calls like if(date1 > date2) or reading from a database in C. if yes please with example
0
Comment
Question by:manjucee
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
braveheart earned 100 total points
ID: 1252954
If you can relink your program, you could write a library which mimics all system calls using times and dates so that your new function is called instead of the system function.  That way you don't alter the source code of the original program.

Using shared libraries it is possible that your mimic functions can then call system functions of the same name but in a system library, although I don't remember the details.

0
 
LVL 11

Expert Comment

by:alexo
ID: 1252955
Unfortunately, no.
You see, you can trap a system (API) call at runtime but "if(date1 > date2)" and similar are implemented using inline code and not function calls.  Reading a DB is too general.  How would you know what constitutes a DB read?  There are hundreds of DB systems, each with it's oun I/O routines.
0
 

Author Comment

by:manjucee
ID: 1252956
Hi Braveheart
                     It would be better if you give more information .
0
 
LVL 3

Expert Comment

by:braveheart
ID: 1252957
Say you are using a DB routine called db_getdate(). You could write your own version of db_getdate() which would call the original routine but would adjust the year appropriately.

Assuming that the data in your database never refers to a date prior to 1960, say, then your version of db_getdate would add
100 to any year less than 60 but returns the original value if the year was greater than or equal to 60.

This approach assumes that you treat the year as an integer rather than a two character string internally. If you use the string approach then the only way you can do a conversion is if all date manipulations are performed by functions which you can over-ride in the same way as the above example. It's an aspect of object oriented programming ;-).

This technique puts off the evil day when you need to rewrite your application and the contents of your database for another 60 years.
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Using unmanaged DLL from managed application 14 294
Finding a good hash function 4 127
How to learn Linux? 10 66
Windows Server 2012  Backup - HyperV host 18 58
Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.

808 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