[DISCUSSION] VirtualBox - Update, SLP & SLIC

Discussion in 'Virtualization' started by cigolo_, Dec 30, 2008.

  1. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,557
    3,832
    120
    #81 FreeStyler, Aug 4, 2010
    Last edited by a moderator: Apr 20, 2017
    If you search and replace the following hex values in VBoxDD2.dll (taken from VirtualBox v3.2.6 x64) you are able to use the XP Mode Mode vhd in VirtualBox without having to swap oembios files

    orginal
    Code:
    C4048946FE8B461688E030E4E9D101FF7616BBBDCE53B8070050E8FA7683C40683C400E9D801E9D501B81300508B460A50FF76
    replacement (ASCII = Windows_Virtual_XP_F9161D8E7FCC11DDBFAA369856D89593)
    Code:
    57696E646F77735F5669727475616C5F58505F4639313631443845374643433131444442464141333639383536443839353933
     
  2. ginzon

    ginzon MDL Novice

    Aug 25, 2009
    30
    0
    0
    Cooolll!! Good XP can be i'll try..
     
  3. 22bsti

    22bsti MDL Novice

    Oct 23, 2009
    1
    0
    0
    Anybody know if you can hexedit the 32bit dll to use the xpmode vhd?
     
  4. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,557
    3,832
    120
    #84 FreeStyler, Oct 12, 2010
    Last edited by a moderator: Apr 20, 2017
    Update VirtualBox v3.2.10 x64:
    If you search and replace the following hex values in VBoxDD2.dll you are able to use the XP Mode Mode vhd in VirtualBox without having to swap oembios files

    orginal
    Code:
    BE8FFC8FFC8FFC8FFC8FD28FFC8FFC8FE94CFF83C40C8A461830E40D00018946188B461888E030E450B8740050B8400050E8D4
    replacement (ASCII = Windows_Virtual_XP_F9161D8E7FCC11DDBFAA369856D89593)
    Code:
    57696E646F77735F5669727475616C5F58505F4639313631443845374643433131444442464141333639383536443839353933
     
  5. sebus

    sebus MDL Guru

    Jul 23, 2008
    6,356
    2,026
    210
    And there should be extra free spaces just above it, so one can add a text string like Hewlett-Packard as well

    This works on Vmlite Workstation (tested)

    sebus
     
  6. Daz

    Daz MDL Developer / Admin
    Staff Member

    Jul 31, 2009
    9,534
    67,254
    300
    #88 Daz, Nov 23, 2010
    Last edited by a moderator: Apr 20, 2017
    From atreyu's code to allow SLIC's of any size under 374 bytes:
    Code:
    include macros.inc
    incluse shell32
    
    include slic.inc
    
    DLL_ID struct
        fileSize    dd ?
        crcOffset   dd ?
        crcLength   dd ?
        crcSlice    dd ?
        crcValue    dd ?
        patch       dd ?
        reset       dd ?
        fileTime    FILETIME <>
    DLL_ID ends
    
    .data
    dllPath     db MAX_PATH dup(0)
    fixPath     db MAX_PATH dup(0)
    error       dd 0
    
    dllIndex    dd -1
    original    db 0
    
    align 4
    helpMsg         db  "Adds a SLIC table to Virtual Box BIOS",13,10, \
                        "Usage: vbslic VBoxDD.dll [slic_dump]",13,10,0
    fileNotFound    db  "Could not open '%s'",13,10,0
    unknownDll      db  "The version of '%s' is not supported",13,10,0
    badSlicData     db  "Dump '%s' has a bad size",13,10,0
    dllRestored     db  "SLIC table was removed from '%s'",13,10,0
    dllPatched      db  "SLIC table was added to '%s'",13,10,0
    cantWrite       db  "Could not write to '%s' (run as admin)",13,10,0
    max_msgsize equ 132 + MAX_PATH
    
    align 16
    slic    db  53h, 4Ch, 49h, 43h, 76h, 01h, 00h, 00h, 01h, 9Bh, 48h, 50h, 51h, 4Fh, 45h, 4Dh
            db  53h, 4Ch, 49h, 43h, 2Dh, 4Dh, 50h, 43h, 00h, 00h, 04h, 06h, 20h, 4Ch, 54h, 50h
            db  01h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 9Ch, 00h, 00h, 00h, 06h, 02h, 00h, 00h
            db  00h, 24h, 00h, 00h, 52h, 53h, 41h, 31h, 00h, 04h, 00h, 00h, 01h, 00h, 01h, 00h
            db  5Bh,0ABh, 60h, 56h,0BCh, 58h, 1Eh,0E8h,0C1h,0D2h,0A1h, 5Ch,0E5h, 4Fh,0BBh,0FDh
            db  1Dh,0A9h, 8Ch, 94h,0B4h,0AEh, 08h, 11h,0DCh, 13h, 59h,0D3h, 7Fh,0F6h, 3Eh, 87h
            db  31h,0B9h, 95h, 74h, 10h,0DAh, 3Bh,0A4h, 5Bh,0B5h, 19h, 82h, 7Ch, 39h,0D7h, 0Dh
            db  7Ch, 22h,0ACh, 1Ch, 2Ah, 84h,0E9h, 0Ah, 88h, 6Dh,0FAh,0B1h,0E2h,0D8h,0E8h, 21h
            db  96h,0E1h, 2Eh, 68h, 9Ah,0BFh, 44h, 45h, 3Eh, 3Ch, 8Eh, 99h, 90h,0DEh, 37h, 38h
            db  57h, 0Bh, 92h, 15h,0BCh,0DEh,0FFh,0F2h, 07h, 7Eh,0B5h, 40h, 8Ch, 51h, 3Ah,0C3h
            db  02h, 48h,0F6h, 13h, 12h, 72h,0FBh, 42h, 78h,0E6h, 47h, 88h, 54h,0C7h,0B0h,0F0h
            db  93h, 9Eh,0FBh, 04h,0B7h,0B8h,0B8h, 90h,0DEh,0DBh,0EDh, 32h,0E1h,0FBh, 54h,0A6h
            db  01h, 00h, 00h, 00h,0B6h, 00h, 00h, 00h, 00h, 00h, 02h, 00h, 48h, 50h, 51h, 4Fh
            db  45h, 4Dh, 53h, 4Ch, 49h, 43h, 2Dh, 4Dh, 50h, 43h, 57h, 49h, 4Eh, 44h, 4Fh, 57h
            db  53h, 20h, 01h, 00h, 02h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
            db  00h, 00h, 00h, 00h, 00h, 00h, 30h, 90h, 1Fh,0B4h,0A4h,0BEh, 80h, 1Eh,0E9h, 33h
            db 0ECh, 7Fh,0FCh,0B1h, 28h, 0Eh,0A6h,0CEh, 43h, 72h, 8Ch, 79h, 30h,0B4h,0F4h, 59h
            db 0EAh, 7Dh,0CFh,0B7h, 11h, 8Bh,0DAh, 70h,0C5h,0C8h, 3Fh, 79h, 20h, 08h, 6Fh, 64h
            db 0CAh, 07h, 88h,0B3h,0B1h, 16h,0B4h,0BAh, 1Ah,0F1h, 85h, 52h,0B1h,0F5h, 07h, 55h
            db 0B5h, 70h, 61h,0EFh, 44h, 8Ch,0AAh, 5Fh, 78h, 14h, 66h, 98h, 9Ch,0F3h, 58h,0D8h
            db 0AAh, 48h,0E0h, 37h,0F8h,0F6h,0ABh, 64h,0FAh,0DAh, 17h, 2Ah, 62h,0E3h, 04h, 1Dh
            db  32h, 2Dh,0D5h,0EAh, 33h, 66h, 5Ch, 5Bh, 3Bh, 0Eh,0F7h, 09h, 66h, 42h, 32h,0AAh
            db  14h, 99h,0C3h,0EEh, 1Ah, 62h, 3Bh, 07h, 5Fh,0F0h, 48h, 44h,0C4h,0E6h, 32h, 59h
            db  1Fh, 14h, 3Eh,0F1h,0B2h, 38h
    
    include patch_321032.inc
    include reset_321032.inc
    include patch_321064.inc
    include reset_321064.inc
    
    align 16
    identify    DLL_ID <1C0A10h, 0AECDAh, 100526h,0FC4D2055h, 27E49EC1h, patch_321032, reset_321032, <05807FF00h, 1CB66F9h>>
                DLL_ID <20B010h, 0E0C5Eh, 1273A2h, 9BCA7B03h, 570E4035h, patch_321064, reset_321064, <0A799FB00h, 1CB66F8h>>
                dd 0
    
    include crc32.asm
    
    .code
    
    printf proc format:LPCSTR, path:LPCSTR
        local hFile:dword, bytesToWrite:dword, bytesWritten:dword
        local buffer[max_msgsize]:byte
    
        invoke GetStdHandle, STD_OUTPUT_HANDLE
        mov hFile, eax
    
        invoke wsprintf, addr buffer, format, path
        mov bytesToWrite, eax
    
        invoke WriteFile, hFile, addr buffer, bytesToWrite, addr bytesWritten, NULL
    
        return
    printf endp
    
    
    identifyDll proc uses ebx esi edi
        local hFile:dword, hMap:dword, hView:dword
        local szHigh:dword, szLow:dword, done:dword
        and done, false
    
        invoke CreateFile, offset dllPath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0
        .if eax != INVALID_HANDLE_VALUE
            mov hFile, eax
            invoke GetFileSize, hFile, addr szHigh
            mov edx, szHigh
            mov szLow, eax
            .if eax && !edx && eax < 800000h
                invoke CreateFileMapping, hFile, NULL, PAGE_READONLY, 0, 0, NULL
                .if eax != NULL
                    mov hMap, eax
                    invoke MapViewOfFile, hMap, FILE_MAP_READ, 0, 0, 0
                    .if eax != NULL
                        mov hView, eax
                        mov esi, eax
                        xor edi, edi
                        mov ebx, offset identify
                        assume ebx:ptr DLL_ID
                        .while [ebx].fileSize
                            mov eax, szLow
                            mov edx, esi
                            .if eax == [ebx].fileSize
                                add edx, [ebx].crcOffset
                                invoke crc32, edx, [ebx].crcLength
                                .if eax == [ebx].crcSlice
                                    mov dllIndex, edi
                                    or done, true
                                    invoke crc32, esi, [ebx].fileSize
                                    .if eax == [ebx].crcValue
                                        or original, true
                                    .endif
                                    .break
                                .endif
                            .endif
                            inc edi
                            add ebx, sizeof DLL_ID
                        .endw
                        assume ebx:nothing
                        .if dllIndex == -1
                            invoke printf, offset unknownDll, offset dllPath
                            or error, 1
                        .endif
                        invoke UnmapViewOfFile, hView
                    .endif
                    invoke CloseHandle, hMap
                .endif
            .endif
            invoke CloseHandle, hFile
        .endif
        
        .if !done && !error
            invoke printf, offset fileNotFound, offset dllPath
            or error, 2
        .endif
        return done
    identifyDll endp
    
    
    readSlicData proc
        local hFile:dword, szHigh:dword, szLow:dword
        local bytesRead:dword, done:dword
        and done, false
    
        invoke CreateFile, offset fixPath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0
        .if eax != INVALID_HANDLE_VALUE
            mov hFile, eax
            invoke GetFileSize, hFile, addr szHigh
            mov edx, szHigh
            mov szLow, eax
            invoke ReadFile, hFile, offset slic, sizeof SLIC, addr bytesRead, NULL
            .if bytesRead <= sizeof SLIC
                or done, true
            .endif
            invoke CloseHandle, hFile
        .endif
        
        .if !done && !error
            invoke printf, offset fileNotFound, offset fixPath
            or error, 4
        .endif
        return done
    readSlicData endp
    
    
    doIt proc uses ebx esi edi script:ptr, pMessageDone:LPCSTR, pFileTime:ptr FILETIME
        local hFile:dword, hMap:dword, hView:dword
        local szHigh:dword, szLow:dword, done:dword
        and done, false
    
        invoke CreateFile, offset dllPath, GENERIC_READ or GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0
        .if eax != INVALID_HANDLE_VALUE
            mov hFile, eax
            invoke GetFileSize, hFile, addr szHigh
            mov edx, szHigh
            mov szLow, eax
            .if eax && !edx && eax < 800000h
                invoke CreateFileMapping, hFile, NULL, PAGE_READWRITE, 0, 0, NULL
                .if eax != NULL
                    mov hMap, eax
                    invoke MapViewOfFile, hMap, FILE_MAP_WRITE, 0, 0, 0
                    .if eax != NULL
                        mov hView, eax
                        mov esi, script
                        mov ebx, eax
                        mov edi, eax
                        .while byte ptr [esi]
                            movzx eax, byte ptr [esi]
                            shl eax, 3
                            shr al, 3
                            inc al
                            inc esi
                            movzx ecx, al
                            .if ah == 1 ;copy to absolute address
                                mov edi, dword ptr [esi]
                                add edi, ebx
                                add esi, 4
                                rep movsb
                            .elseif ah == 2 ;copy to relative address
                                movzx eax, byte ptr [esi]
                                add edi, eax
                                inc esi
                                rep movsb
                            .elseif ah == 3 ;zero to absolute address
                                mov edi, dword ptr [esi]
                                add edi, ebx
                                add esi, 4
                                xor al, al
                                rep stosb
                            .elseif ah == 4 ;zero to relative address
                                movzx eax, byte ptr [esi]
                                add edi, eax
                                inc esi
                                xor al, al
                                rep stosb
                            .elseif ah == 7 ;patch/reset absolute address
                                mov edi, dword ptr [esi]
                                add edi, ebx
                                add esi, 4
                                mov ecx, sizeof SLIC
                                .if al == 1 ;reset
                                    xor al, al
                                    rep stosb
                                .else ;patch
                                    push esi
                                    mov esi, offset slic
                                    .if al != 2
                                        xor ecx, ecx
                                        .if al == 3
                                            add esi, offset SLIC.OEM_ID
                                            add ecx, sizeof SLIC.OEM_ID
                                        .elseif al == 4
                                            add esi, offset SLIC.OEM_TID_1
                                            add ecx, sizeof SLIC.OEM_TID_1
                                        .elseif al == 5
                                            add esi, offset SLIC.OEM_TID_2
                                            add ecx, sizeof SLIC.OEM_TID_2
                                        .endif
                                    .endif
                                    rep movsb
                                    pop esi
                                .endif
                            .endif
                        .endw
                        or done, true
                        invoke FlushViewOfFile, hView, 0
                        invoke UnmapViewOfFile, hView
                    .endif
                    invoke CloseHandle, hMap
                .endif
            .endif
            .if pFileTime
                invoke SetFileTime, hFile, NULL, NULL, pFileTime
            .endif
            invoke CloseHandle, hFile
        .endif
        
        .if done
            invoke printf, pMessageDone, offset dllPath
        .else
            invoke printf, offset cantWrite, offset dllPath
            or error, 5
        .endif
        return done
    doIt endp
    
    
    restoreDll proc
        imul edx, dllIndex, sizeof DLL_ID
        add edx, offset identify
        invoke doIt, (DLL_ID ptr [edx]).reset, offset dllRestored, addr (DLL_ID ptr [edx]).fileTime
        return eax
    restoreDll endp
    
    
    patchDll proc
        imul edx, dllIndex, sizeof DLL_ID
        add edx, offset identify
        invoke doIt, (DLL_ID ptr [edx]).patch, offset dllPatched, NULL
        return eax
    patchDll endp
    
    
    copyCmdArg proc uses esi edi want:dword, dest:LPCSTR
    
        invoke GetCommandLine
        mov esi, eax
        mov edi, eax
        xor al, al
        or ecx, -1
        repne scasb
        not ecx
        dec ecx
    
        xor edx, edx
        mov edi, esi
        .repeat
            mov al, ' '
            .if [edi] == al
                repe scasb
                dec edi
                inc ecx
            .endif
            xor eax, eax
            mov al, [edi]
            .break .if !al
            .if al != '"'
                mov al, ' '
            .else
                inc edi
                dec ecx
            .endif
            mov esi, edi
            repne scasb
            mov eax, edi
            .if found
                dec eax
            .endif
            .if edx == want
                mov ecx, eax
                sub ecx, esi
                mov eax, MAX_PATH
                .if ecx >= eax
                    mov ecx, eax
                    dec ecx
                .endif
                mov eax, dest
                mov edi, eax
                rep movsb
                .break
            .endif
            inc edx
        .until NULL
    
        return eax
    copyCmdArg endp
    
    start:
        invoke copyCmdArg, 1, offset dllPath
        invoke copyCmdArg, 2, offset fixPath
    
        mov eax, offset dllPath
        .if byte ptr [eax] == 0 || word ptr [eax] == MAGIC('/?')
            invoke printf, offset helpMsg, NULL
        .else
            invoke identifyDll
            .if eax
                mov edx, offset fixPath
                .if byte ptr [edx] != 0
                    invoke readSlicData
                    .if eax
                        invoke patchDll
                    .endif
                .elseif !original
                    invoke restoreDll
                .else
                    invoke patchDll
                .endif
            .endif
        .endif
        
        invoke ExitProcess, error
    
    end start
    Of course you can trim down the SLIC.bin file yourself but make sure you edit the SLIC size too (76 01).

    This is only really useful for debug situations, had to do it myself to simulate a 36 byte SLIC.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. sebus

    sebus MDL Guru

    Jul 23, 2008
    6,356
    2,026
    210
    And at such tiny size it is still a valid SLIC?

    sebus
     
  8. Daz

    Daz MDL Developer / Admin
    Staff Member

    Jul 31, 2009
    9,534
    67,254
    300
    It's not valid but there are actually some systems which are now being sold with SLIC's that are only 36 bytes.

    The loader can be forceful and use the 36 bytes and anything following to fit the full 374 byte SLIC. Often theres free space following the 36 byte SLIC's but in some cases theres not which is why we had to add the option to ignore any existing SLIC and add a new one someplace else. Of course when adding a new SLIC the old invalid one gets removed too.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. Allo

    Allo MDL Member

    Jul 29, 2009
    133
    44
    10
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. sebus

    sebus MDL Guru

    Jul 23, 2008
    6,356
    2,026
    210
    Yes, you are missing the WHOLE concept
    Slic 2.1 is for Windows 7
    SLP 1.0 is for XP

    Once you know the very fact, read this thread again (and maybe again & again)

    sebus
     
  11. user_hidden

    user_hidden MDL Expert

    Dec 18, 2007
    1,034
    1,061
    60
    4.0.0 final is out, anyone care to update the vbslic.exe ?
     
  12. Allo

    Allo MDL Member

    Jul 29, 2009
    133
    44
    10
    Isn't Slic 2.1 "downward compatiable"? Meaning XP/Vista & 7 can all activated with OEM SLP with Bios that contains Slic 2.1.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,557
    3,832
    120
    Yes, it is backward compatible with slic 2.0, eg: SLP 2 for Vista/Windows Server 2008, but not compatible with SLP 1 XP/Server 2003
     
  14. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,557
    3,832
    120
    VirtualBox 4.0.0 is out!
    atreyu, can we count on you for a new SLIC patch for the 4.x branch?

    EDIT: Oops this was already mentioned by user_hidden :eek:
     
  15. b166er

    b166er MDL Junior Member

    Sep 9, 2009
    71
    1
    0
    Version 4

    Apparently this version virtualises Intel E1000 with PXE. Does this mean we could use the SLIC designed for NIC ROMs?
     
  16. sebus

    sebus MDL Guru

    Jul 23, 2008
    6,356
    2,026
    210
    Could be, first need to know where to replace the pxe code with windslic

    sebus
     
  17. atreyu

    atreyu MDL Junior Member

    Nov 15, 2009
    63
    132
    0