Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > MSDOS Programmer > Re: Changing Fi...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 10 of 17 Topic 401 of 508
Post > Topic >>

Re: Changing File Date...

by Herbert Kleebauer <klee@[EMAIL PROTECTED] > May 30, 2006 at 12:07 AM

JoAnne wrote:

> In answer to above, "No, no dishonorable intention." I just would like
> to place a number in a file somewhere so that a piece of software will
> (eventually) "expire" and I recognize that "todays date" on such a
> file is not a good way to go!  <g>

That's not worth the effort. If it is not a very good software, then
people don't even try it if the know that the software expires. And if
it is a good software, then somebody will crack it and Google will find
the crack. Better insert some decent reminder to register the software
(but not to annoying or it will also be cracked). 

But nevertheless, here is a small Windows program (Win9x - XP) which can 
set all three dates (creation/last modfied/last accessed) on a NTFS 
volume (on FAT32 only the last modified date is stored). You can 
generate _sd.exe with this batch and save it, or generate it every
time you need it dynamically. The usage is the same as for the DOS
program (using INT 21h AX=5701) I already posted (works also for
Win9x - XP, but can only set the last modified date).

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@[EMAIL PROTECTED]
 off
echo Bj@[EMAIL PROTECTED]
(DE(DM(DO(Dh(Ls(Lu(LX(LeZRR]EEEUYRX2Dx=>_sd.com
echo 0DxFP,0Xx.t0P,=XtGsB4o@[EMAIL PROTECTED]
 WwX0GwUY Wv;ovBX2Gv0ExGIuht6>>_sd.com
echo T}{zx~@[EMAIL PROTECTED]
>>_sd.com
echo pky_jN@[EMAIL PROTECTED]
>>_sd.com
echo QFvAXUS?_YLTS@[EMAIL PROTECTED]
>>_sd.com
echo bD_nsDddlTr_sPdlnTcnaTv_xP_ngD_rhDhsrT_kkDhrtT_fmDRNCTILk?>>_sd.com
echo staThg_So_rPfnqTl`qTdq_ShtpTrdqThV_Sqrm@[EMAIL PROTECTED]
>>_sd.com
echo OdFXu?N?_B@[EMAIL PROTECTED]
>>_sd.com
echo OQO?QOU?DXO?IXO?QOW?RXgOWQO?mYX?wdsTKSs@[EMAIL PROTECTED]
>>_sd.com
echo XOsQOOCQO_UQO_cQO_DXO?XOM@[EMAIL PROTECTED]
>>_sd.com
echo CQO_UQO_cQO_FXO?hwDTqOsTdbnTSrrDsdFTcsRTm`GTdkcTdFUSnBsT`l>>_sd.com
echo lTKcmTdmhTRS@[EMAIL PROTECTED]
>>_sd.com
echo OGT?p??@[EMAIL PROTECTED]
>>_sd.com
echo @[EMAIL PROTECTED]
>>_sd.com
echo @[EMAIL PROTECTED]
>>_sd.com
echo 1SSUgFzz@[EMAIL PROTECTED]
>>_sd.com
echo g??P?PsRsg?s??PCT~OL?OKO?H?ogJsPT~UK?O?O@[EMAIL PROTECTED]
>>_sd.com
echo Fr??PC?PsQuN?_?HEoEasPqo{Ox{V?kRv@[EMAIL PROTECTED]
>>_sd.com
echo ]d~r??PC`XBB0x>>_sd.com

_sd.com>_sd.exe

echo hello>test.txt
dir /tc test.txt | find "test.txt"
dir /ta test.txt | find "test.txt"
dir /tw test.txt | find "test.txt"
echo.

::      yyyy mm dd hh mm ss ; new file date (create/modified/accessed)
_sd.exe 1999 12 24 18 33 17 >>test.txt
dir /tc test.txt | find "test.txt"
dir /ta test.txt | find "test.txt"
dir /tw test.txt | find "test.txt"

del _sd.com
del _sd.exe
del test.txt
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

The source code:

winmain::
        jsr.l   (GetCommandLineA)
                        ; skip program name
        eor.l   r1,r1   ; not within ""
        dec.l   r0
_20:    inc.l   r0
        cmp.b   #0,(r0)
        beq.b   _10
        cmp.b   #'"',(r0)
        bne.b   _30
        not.l   r1
_30:    or.l    r1,r1
        bne.b   _20
        cmp.b   #' ',(r0)
        bne.b   _20
        inc.l   r0
_10:    move.l  r0,r5

        move.l  #SystemTime,r6

        bsr.l   get_number      ; year
        cmp.w   #1601,r3
        blo.b   _err1
        cmp.w   #30827,r3
        bhi.b   _err2
        move.l  r3,(r6)         ; year + dummy month
        inc.l   r6
        inc.l   r6
        
        bsr.l   get_number      ; month
        cmp.w   #1,r3
_err1:  blo.l   err
        cmp.w   #12,r3
        bhi.b   _err2
        move.l  r3,(r6)         ; month + dummy DayOfWeek
        addq.l  #4,r6           ; skip DayOfWeek 

        
        bsr.l   get_number      ; day
        cmp.w   #1,r3
        blo.b   _err1
        cmp.w   #31,r3
        bhi.b   _err2
        move.l  r3,(r6)         ; day + dummy hour
        inc.l   r6
        inc.l   r6

        bsr.l   get_number      ; hour
        cmp.w   #23,r3
        bhi.b   _err2
        move.l  r3,(r6)         ; hour + dummy minute
        inc.l   r6
        inc.l   r6

        bsr.l   get_number      ; minute
        cmp.w   #59,r3
_err2:  bhi.b   err
        move.l  r3,(r6)         ; minute + dummy second
        inc.l   r6
        inc.l   r6

        bsr.l   get_number      ; second
        cmp.l   #59,r3
        bhi.b   err
        move.l  r3,(r6)         ; second + clear milliseconds

        move.l  #FileTime,-(sp)
        move.l  #SystemTime,-(sp)
        jsr.l   (SystemTimeToFileTime)
        or.l    r0,r0
        beq.b   err

        moveq.l #-11,-(sp)
        jsr.l   (GetStdHandle)

        move.l  #FileTime,-(sp)
        move.l  #FileTime,-(sp)
        move.l  #FileTime,-(sp)
        move.l  r0,-(sp)
        jsr.l   (SetFileTime)
        or.l    r0,r0
        beq.b   err
        
        move.l  #0,-(sp)
        jsr.l   (ExitProcess)   ; exit program

err:    move.l  #1,-(sp)
        jsr.l   (ExitProcess)   ; exit program

get_number:
        eor.l   r3,r3
        move.l  #_10,_200
_10:    movu.bl (r5),r0
        or.l    r0,r0
        beq.b   _100
        inc.l   r5
        cmp.b   #'0',r0
        blo.b   _20
        cmp.b   #'9',r0
        bhi.b   _20
        sub.b   #'0',r0
        mulsq.l #10,r3,r3
        add.l   r0,r3
        move.l  #_100,_200
        br.b    _10
_20:    jmp.l   (_200)
_100:   rts.l
_200:   dc.l    0




        even 4
SystemTime:
Year:           blk.w  1
Month:          blk.w  1
DayOfWeek:      blk.w  1
Day:            blk.w  1
Hour:           blk.w  1
Minute:         blk.w  1
Second:         blk.w  1
Milliseconds:   blk.w  1


FileTime:       blk.l   2
 




 17 Posts in Topic:
Changing File Date...
JoAnne <mwsoft@[EMAIL   2006-05-26 16:11:29 
Re: Changing File Date...
Wildman <wildman@[EMAI  2006-05-26 22:30:29 
Re: Changing File Date...
Herbert Kleebauer <kle  2006-05-27 17:18:24 
Re: Changing File Date...
Wildman <wildman@[EMAI  2006-05-27 15:28:48 
Re: Changing File Date...
erewhon@[EMAIL PROTECTED]  2006-05-27 10:22:27 
Re: Changing File Date...
JoAnne <mwsoft@[EMAIL   2006-05-27 16:27:51 
Re: Changing File Date...
erewhon@[EMAIL PROTECTED]  2006-05-28 13:47:43 
Re: Changing File Date...
Herbert Kleebauer <kle  2006-05-28 16:44:59 
Re: Changing File Date...
JoAnne <mwsoft@[EMAIL   2006-05-29 14:03:40 
Re: Changing File Date...
Herbert Kleebauer <kle  2006-05-30 00:07:31 
Re: Changing File Date...
Wildman <wildman@[EMAI  2006-05-30 19:10:22 
Re: Changing File Date...
Herbert Kleebauer <kle  2006-05-31 12:41:46 
Re: Changing File Date...
Wildman <wildman@[EMAI  2006-05-31 07:29:59 
Re: Changing File Date...
Herbert Kleebauer <kle  2006-05-31 15:30:13 
Re: Changing File Date...
Wildman <wildman@[EMAI  2006-06-02 19:43:21 
Re: Changing File Date...
Dr John Stockton <jrs@  2006-05-28 21:27:23 
Re: Changing File Date...
Timo Salmi <ts@[EMAIL   2006-05-31 07:54:35 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Dec 3 15:04:21 CST 2008.