def tag_str_to_num(s):
  """Convert the DosType in a 4 letter tag string to 32 bit value"""
  if len(s) != 4:
    return 0
  a = ord(s[0]) << 24
  b = ord(s[1]) << 16
  c = ord(s[2]) << 8
  l = s[3]
  d = ord(l)
  if l.isdigit():
    d = d - ord('0')
  return a+b+c+d