[API]
RtlMoveMemory
ReadFile
CloseHandle
LocalAlloc
LocalFree
SetFilePointer
CloseHandle

[INCLUDE]
CreateFile
RegionSet_Free

[CODE]
Public Function RegionSet_Load(ByVal Filename As String) As Long
  Dim xNumEnts(5) As Integer
  Dim xSize As Long
  Dim hFile As Long
  Dim xLong1 As Long

  hFile = CreateFile(Filename, OpenExisting, FILE_READ)
  If Not hFile = -1& Then
    If Not ReadFile(hFile, ByVal VarPtr(xNumEnts(0&)), 12&, xLong1, 0&) = 0& Then
      If xLong1 = 12& Then
        xSize = 12& + xNumEnts(0&) * 9& + (xNumEnts(1&) + xNumEnts(2&) + xNumEnts(3&) + xNumEnts(4&) + xNumEnts(5&)) * 4&
        RegionSet_Load = LocalAlloc(0&, xSize)
        If Not RegionSet_Load = 0& Then
          If SetFilePointer(hFile, 0&, 0&, 0&) = 0& Then
            If Not ReadFile(hFile, ByVal RegionSet_Load, xSize, xLong1, 0&) = 0& Then
              If xLong1 = xSize Then
                GoTo Success
                End If
              End If
            End If
          Call LocalFree(RegionSet_Load)
Success:
          End If
        End If
      End If
    Call CloseHandle(hFile)
    End If
  End Function
