Archive: WriteRegStr


WriteRegStr
HI ,

I am writing a date as a key into registry using WriteRegStr.But Some times registry varible is not getting created .

Any body has idea what might go wrong?

Thanks


where does this date come from, what format?


Using the following function i am getting the date in dd-mm-yyyy format.

Function GetTime
!define GetTime `!insertmacro GetTimeCall`

!macro GetTimeCall _FILE _OPTION _R1 _R2 _R3 _R4 _R5 _R6 _R7
Push `${_FILE}`
Push `${_OPTION}`
Call GetTime
Pop ${_R1}
Pop ${_R2}
Pop ${_R3}
Pop ${_R4}
Pop ${_R5}
Pop ${_R6}
Pop ${_R7}
!macroend

Exch $1
Exch
Exch $0
Exch
Push $2
Push $3
Push $4
Push $5
Push $6
Push $7
ClearErrors

StrCmp $1 'L' gettime
StrCmp $1 'A' getfile
StrCmp $1 'C' getfile
StrCmp $1 'M' getfile
StrCmp $1 'LS' gettime
StrCmp $1 'AS' getfile
StrCmp $1 'CS' getfile
StrCmp $1 'MS' getfile
goto error

getfile:
IfFileExists $0 0 error
System::Call /NOUNLOAD '*(i,l,l,l,i,i,i,i,&t260,&t14) i .r6'
System::Call /NOUNLOAD 'kernel32::FindFirstFileA(t,i)i(r0,r6) .r2'
System::Call /NOUNLOAD 'kernel32::FindClose(i)i(r2)'

gettime:
System::Call /NOUNLOAD '*(&i2,&i2,&i2,&i2,&i2,&i2,&i2,&i2) i .r7'
StrCmp $1 'L' 0 systemtime
System::Call /NOUNLOAD 'kernel32::GetLocalTime(i)i(r7)'
goto convert
systemtime:
StrCmp $1 'LS' 0 filetime
System::Call /NOUNLOAD 'kernel32::GetSystemTime(i)i(r7)'
goto convert

filetime:
System::Call /NOUNLOAD '*$6(i,l,l,l,i,i,i,i,&t260,&t14)i(,.r4,.r3,.r2)'
System::Free /NOUNLOAD $6
StrCmp $1 'A' 0 +3
StrCpy $2 $3
goto tolocal
StrCmp $1 'C' 0 +3
StrCpy $2 $4
goto tolocal
StrCmp $1 'M' tolocal

StrCmp $1 'AS' tosystem
StrCmp $1 'CS' 0 +3
StrCpy $3 $4
goto tosystem
StrCmp $1 'MS' 0 +3
StrCpy $3 $2
goto tosystem

tolocal:
System::Call /NOUNLOAD 'kernel32::FileTimeToLocalFileTime(*l,*l)i(r2,.r3)'
tosystem:
System::Call /NOUNLOAD 'kernel32::FileTimeToSystemTime(*l,i)i(r3,r7)'

convert:
System::Call /NOUNLOAD '*$7(&i2,&i2,&i2,&i2,&i2,&i2,&i2,&i2)i(.r5,.r6,.r4,.r0,.r3,.r2,.r1,)'
System::Free $7

IntCmp $0 9 0 0 +2
StrCpy $0 '0$0'
IntCmp $1 9 0 0 +2
StrCpy $1 '0$1'
IntCmp $2 9 0 0 +2
StrCpy $2 '0$2'
IntCmp $6 9 0 0 +2
StrCpy $6 '0$6'

StrCmp $4 0 0 +3
StrCpy $4 Sunday
goto end
StrCmp $4 1 0 +3
StrCpy $4 Monday
goto end
StrCmp $4 2 0 +3
StrCpy $4 Tuesday
goto end
StrCmp $4 3 0 +3
StrCpy $4 Wednesday
goto end
StrCmp $4 4 0 +3
StrCpy $4 Thursday
goto end
StrCmp $4 5 0 +3
StrCpy $4 Friday
goto end
StrCmp $4 6 0 error
StrCpy $4 Saturday
goto end

error:
SetErrors
StrCpy $0 ''
StrCpy $1 ''
StrCpy $2 ''
StrCpy $3 ''
StrCpy $4 ''
StrCpy $5 ''
StrCpy $6 ''

end:
Pop $7
Exch $6
Exch
Exch $5
Exch 2
Exch $4
Exch 3
Exch $3
Exch 4
Exch $2
Exch 5
Exch $1
Exch 6
Exch $0
FunctionEnd


sorry, I have no idea.


Is the problem with the date being empty or the key not being created? If the key is empty, the problem is in the function. If it's not created, it's somewhere else. If you attach the script, it'd be easier to see where is the problem.