# Reading negative DWORD from registry

**URL:** <https://www.finalbuilder.com/forums/t/reading-negative-dword-from-registry/4482>\
**Category:** Discussion\
**Created:** [July 26, 2011, 12:24pm UTC](https://www.finalbuilder.com/forums/t/reading-negative-dword-from-registry/4482 "2011-07-26T12:24:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrrimmer](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@mrrimmer](https://www.finalbuilder.com/forums/u/mrrimmer)\
**Post date:** [July 26, 2011, 12:24pm UTC](https://www.finalbuilder.com/forums/t/reading-negative-dword-from-registry/4482/1 "2011-07-26T12:24:29Z")

</div>

Hi,

Am fairly new to Automise, and am trying to read in a UTC date from an FTP&nbsp;site and convert it to local date.&nbsp; The above registry key contains the offset, which is -60 mins, but this is being read into the automise variable as 4294967236 (0xffffffc4).

What's going to be the best way of interpreting a DWORD as a 32 bit signed int rather than as an unsigned int?

Thanks.

---

<div class="post-metadata">

**Author:** ![stephen.ryan](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/f14d63/32.png) [@stephen.ryan](https://www.finalbuilder.com/forums/u/stephen.ryan)\
**Post date:** [July 29, 2011, 6:53am UTC](https://www.finalbuilder.com/forums/t/reading-negative-dword-from-registry/4482/2 "2011-07-29T06:53:22Z")

</div>

Hi   
  
 The DWORD data type stores an unsigned integer which cannot have a value of less than 0. When you view this value in the Registry Editor what does it contain?   
  
 Regards,   
 Steve

---

<div class="post-metadata">

**Author:** ![stephen.ryan](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/f14d63/32.png) [@stephen.ryan](https://www.finalbuilder.com/forums/u/stephen.ryan)\
**Post date:** [July 29, 2011, 9:04am UTC](https://www.finalbuilder.com/forums/t/reading-negative-dword-from-registry/4482/3 "2011-07-29T09:04:25Z")

</div>

Sorry after I posted the response, it dawned on me what you meant.   
  
 To calculate the wrap-around you could do something simple like this (in VBScript). Note that I haven’t added any range checking or anything so if the value is not negative (has not wrapped around) then it will return an invalid value.   
  
 Dim value   
 Dim result   
  
 value = 4294967236   
  
 result = value - 2^32   
  
 Action.SendLogMessage result, stInformation

---

<div class="post-metadata">

**Author:** ![mrrimmer](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@mrrimmer](https://www.finalbuilder.com/forums/u/mrrimmer)\
**Post date:** [July 29, 2011, 10:24am UTC](https://www.finalbuilder.com/forums/t/reading-negative-dword-from-registry/4482/4 "2011-07-29T10:24:54Z")

</div>

Hi, thanks for the reply. As a “workaround” I wrote the following VBScript (where TimeOffset is the variable that is set from the registry value:   
  
 if TimeOffset \> (2 ^ 31) then   
 TimeOffset = TimeOffset - 2 ^ 32   
 end if   
  
 Looks like that is as good as it gets…
