[.net] SLIC BootLoader

Discussion in 'Mixed Languages' started by xxhbdl, Jan 2, 2016.

  1. xxhbdl

    xxhbdl MDL Novice

    Mar 7, 2015
    11
    2
    0
    #1 xxhbdl, Jan 2, 2016
    Last edited by a moderator: Apr 20, 2017
    hi, I would like to ask everyone a hand.
    I am using Bootloader(Zsmin 0.97)
    I have this code.

    Code:
    Dim GUID As String = Environment.GetEnvironmentVariable("SystemDrive")
    
    
    For Each objLIC In GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & "." & "\root\cimv2").ExecQuery("SELECT DeviceID FROM Win32_Volume WHERE SystemVolume='True'")
                    GUID = objLIC.DeviceID.ToString.Replace("?"c, "."c)
    Next
    
    Dim LoaderName As String = "AAAAA"
    File.WriteAllBytes(My.Computer.FileSystem.SpecialDirectories.Temp & "\" & LoaderName, My.Resources.grldr)
    File.Copy(My.Computer.FileSystem.SpecialDirectories.Temp & "\" & LoaderName, GUID & "\" + LoaderName, True)
    
    Dim buffer1 As Integer = &HE25C
    Dim buffer2 As Integer = &H10C12
    Dim SBuffer As Byte() = My.Resources.bootsect1
    Buffer.BlockCopy(Encoding.Unicode.GetBytes(LoaderName), 0, SBuffer, buffer1, 10)
    Buffer.BlockCopy(Encoding.Unicode.GetBytes(LoaderName), 0, SBuffer, buffer2, 10)
    File.WriteAllBytes(My.Computer.FileSystem.SpecialDirectories.Temp & "\brset.exe", SBuffer)
    Threading.Thread.Sleep(100)
    Shell(Chr(34) & My.Computer.FileSystem.SpecialDirectories.Temp & "\brset.exe" & Chr(34), "/nt52 SYS /force")
    Threading.Thread.Sleep(100)
    
    when there is only one partition, this code works.
    when there is a bootable partition (like oem partition), it performs the other partition (OEM).
    the problem is the bootloader.
    could someone please help?
     
  2. QuantumBug

    QuantumBug MDL Developer

    Mar 7, 2012
    1,485
    1,322
    60
    If your For Each code detects more than one instance in *WHERE SystemVolume='True'* it may get confused. You want to specifically and definitively select the partition where your bootsector is.
     
  3. xxhbdl

    xxhbdl MDL Novice

    Mar 7, 2015
    11
    2
    0
    #3 xxhbdl, Jan 4, 2016
    Last edited: Jan 4, 2016
    (OP)
    thanks for the reply. No, the problem is definitely the bootloader. For Each detect only one instance. ^_^
    if i use the daz bootloader, it works. but it is encrypted (?!). if i use Zsmin (one + two + default + slic + four), I have this problem.