Assign a different date for software execution

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
eiem
Newbie
Newbie
Posts: 1
Joined: Tue Mar 30, 2010 10:13 am

Assign a different date for software execution

Post by eiem »

I would like to start a software (which has expiration date!!) giving a differetn date from the one of the system. Is it possible to do it with envoirment variables or any other way? i dont wanna change the true date in my OS !

Thanks

Alex
hellork
Level 3
Level 3
Posts: 82
Joined: Thu Mar 27, 2008 7:13 pm

Re: Assign a different date for software execution

Post by hellork »

eiem wrote:I would like to start a software (which has expiration date!!) giving a differetn date from the one of the system. Is it possible to do it with envoirment variables or any other way? i dont wanna change the true date in my OS !

Thanks

Alex
Wine implements the normal Windows time functions, which get their time from unix (Time Functions, n.d.), so there is no time/date override you can set directly.

However... Wine is open-source, so you could do some hacking.

To get you started, wine's (GetSystemTime, n.d.). is in kernel32. Using grep GetSystemTime within Downloads/src/wine/dlls/kernel32 reveals the function is located in, guess what, time.c

Looking at time.c and using similar detective work (let me know if there is an easier way to navigate this) reveals that wine's implementation is just a wrapper for ntdll time.c NtQuerySystemTime(), which gets the time from unix gettimeofday().

Anywhere along the chain you could, for example, perform some subtraction magic, or even go so far as to get the value to subtract by using the registry. (Registry Functions, n.d.)

Ref.

GetSystemTime Function (Windows). (n.d.). . Retrieved March 31, 2010, from http://msdn.microsoft.com/en-us/library ... S.85).aspx

Registry Functions (Windows). (n.d.). . Retrieved March 31, 2010, from http://msdn.microsoft.com/en-us/library ... S.85).aspx

Time Functions (Windows). (n.d.). . Retrieved March 31, 2010, from http://msdn.microsoft.com/en-us/library ... S.85).aspx
hellork
Level 3
Level 3
Posts: 82
Joined: Thu Mar 27, 2008 7:13 pm

Re: Assign a different date for software execution

Post by hellork »

I'm bored, so here is the rest of my (lack of) knowledge on the subject :)
  • Some windows programs out there can intercept the windows GetSystemTime, GetLocalTime, e.g. http://www.nirsoft.net/utils/run_as_date.html but they don't work with wine because wine's kernel32.dll / ntdll.dll are fake, i.e. you can't just hook functions in them with LoadLibrary() and GetProcAddress() like a regular windows dll.
  • You said you didn't want to change the system time, so the TZ environment variable could be set to report a different time of day, e.g. export TZ=America/Los_Angeles This won't change the date, however.
  • There may be a Linux command line tool that wraps gettimeofday <sys/time.h> but I'm unaware if such a thing exists and wouldn't know how to search for it.
oiaohm
Level 8
Level 8
Posts: 1020
Joined: Fri Feb 29, 2008 2:54 am

Post by oiaohm »

hellork preload file for Linux exist to change data and time. Only one problem wine uses it own loader so that option does not work.

eiem basically stop nicking software and find or start development of something so you don't have to. Wine will never have an offical patch to do the alteration you are requesting.

Name one legal above board reason for requiring todo it.
hellork
Level 3
Level 3
Posts: 82
Joined: Thu Mar 27, 2008 7:13 pm

Post by hellork »

Apparently LD_PRELOAD does work with loading (some) custom libraries for wine--at least for overriding stdio functions. I just tested it with a simple strcmp hack. I don't think wine uses dlopen() for time functions either so that should work, but I'll leave that for somebody else to mess with.
Locked