- Timestamp:
- 05/05/11 21:34:35 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/regfi.c
r250 r251 2753 2753 ret_val->sequence1 = IVAL(file_header, 0x4); 2754 2754 ret_val->sequence2 = IVAL(file_header, 0x8); 2755 ret_val->mtime .low = IVAL(file_header, 0xC);2756 ret_val->mtime .high = IVAL(file_header, 0x10);2755 ret_val->mtime = ((uint64_t)IVAL(file_header, 0x10)) << 32; 2756 ret_val->mtime |= IVAL(file_header, 0xC); 2757 2757 ret_val->major_version = IVAL(file_header, 0x14); 2758 2758 ret_val->minor_version = IVAL(file_header, 0x18); … … 2936 2936 } 2937 2937 2938 ret_val->mtime .low = IVAL(nk_header, 0x4);2939 ret_val->mtime .high = IVAL(nk_header, 0x8);2938 ret_val->mtime = ((uint64_t)IVAL(nk_header, 0x8)) << 32; 2939 ret_val->mtime |= IVAL(nk_header, 0x4); 2940 2940 /* If the key is unallocated and the MTIME is earlier than Jan 1, 1990 2941 2941 * or later than Jan 1, 2290, we consider this a bad key. This helps … … 2943 2943 */ 2944 2944 if(unalloc 2945 && (ret_val->mtime .high < REGFI_MTIME_MIN_HIGH2946 || ret_val->mtime .high > REGFI_MTIME_MAX_HIGH))2945 && (ret_val->mtime < REGFI_MTIME_MIN 2946 || ret_val->mtime > REGFI_MTIME_MAX)) 2947 2947 { goto fail_locked; } 2948 2948 … … 3794 3794 3795 3795 /**************************************************************************** 3796 Put a8 byte filetime from a time_t3796 Returns an 8 byte filetime from a time_t 3797 3797 This takes real GMT as input and converts to kludge-GMT 3798 3798 ****************************************************************************/ 3799 void regfi_unix2nt_time(REGFI_NTTIME *nt,time_t t)3799 REGFI_NTTIME regfi_unix2nt_time(time_t t) 3800 3800 { 3801 3801 double d; 3802 3803 if (t==0) 3804 { 3805 nt->low = 0; 3806 nt->high = 0; 3807 return; 3808 } 3802 3803 if (t==0) 3804 return 0L; 3809 3805 3810 3806 if (t == TIME_T_MAX) 3811 { 3812 nt->low = 0xffffffff; 3813 nt->high = 0x7fffffff; 3814 return; 3815 } 3807 return 0x7fffffffffffffffL; 3816 3808 3817 3809 if (t == -1) 3818 { 3819 nt->low = 0xffffffff; 3820 nt->high = 0xffffffff; 3821 return; 3822 } 3810 return 0xffffffffffffffffL; 3823 3811 3824 3812 /* this converts GMT to kludge-GMT */ … … 3829 3817 /* t -= TimeDiff(t) - get_serverzone(); */ 3830 3818 3831 d = (double)(t); 3832 d += TIME_FIXUP_CONSTANT; 3819 d = (double)(t) + REGFI_TIME_FIXUP; 3833 3820 d *= 1.0e7; 3834 3835 nt->high = (uint32_t)(d * (1.0/(4.0*(double)(1<<30)))); 3836 nt->low = (uint32_t)(d - ((double)nt->high)*4.0*(double)(1<<30)); 3821 /* 3822 nt->high = (uint32_t)(d * (1.0/c)); 3823 nt->low = (uint32_t)(d - ((double)nt->high) * c); 3824 */ 3825 3826 return (REGFI_NTTIME) d; 3837 3827 } 3838 3828 … … 3849 3839 converts this to real GMT. 3850 3840 ****************************************************************************/ 3851 double regfi_nt2unix_time( const REGFI_NTTIME*nt)3841 double regfi_nt2unix_time(REGFI_NTTIME nt) 3852 3842 { 3853 3843 double ret_val; 3854 3855 /* The next two lines are a fix needed for the 3856 broken SCO compiler. JRA. */ 3857 time_t l_time_min = TIME_T_MIN; 3858 time_t l_time_max = TIME_T_MAX; 3859 3860 if (nt->high == 0 || (nt->high == 0xffffffff && nt->low == 0xffffffff)) 3861 return(0); 3862 3863 ret_val = ((double)nt->high)*4.0*(double)(1<<30); 3864 ret_val += nt->low; 3865 ret_val *= 1.0e-7; 3844 3845 if (nt == 0 || nt == 0xffffffffffffffffL) 3846 return 0; 3847 3848 ret_val = (double)(nt) * 1.0e-7; 3866 3849 3867 3850 /* now adjust by 369 years to make the secs since 1970 */ 3868 ret_val -= TIME_FIXUP_CONSTANT; 3869 3870 /* XXX: should these sanity checks be removed? */ 3871 if (ret_val <= l_time_min) 3872 return (l_time_min); 3873 3874 if (ret_val >= l_time_max) 3875 return (l_time_max); 3851 ret_val -= REGFI_TIME_FIXUP; 3876 3852 3877 3853 /* this takes us from kludge-GMT to real GMT */
Note: See TracChangeset
for help on using the changeset viewer.