Avr 282014
 

A cool video on youtube I have seen today around a 3D camera in XNA, well explained.
C# code source given here.

I have decided to translate to Vb.Net and to distribute the full project here.

It goes as is :
declare a camera object, a floor object and basiceffect in your mail class
initialise these variables (and add the cam to the game components)
draw the floor while passing the cam and the basiceffet as parameters

A quick video to demonstrate it (or watch the original video).

 Posted by at 20 h 10 min
Avr 262014
 

It has been a while that I wanted to do this : a X64 version of CloneDisk.

My main drive was to use it from X64 bits WinPE’s.

Well thanks to Delphi XE, I was able (after much corrections) to compile it under a X64 environement.

CloneDisk page here.
Download X64 here.
Download X32 here.

 Posted by at 19 h 01 min
Avr 262014
 

More than once did I spend (lose…) long minutes on google to find the proper syntax with windows bcdedit command line.

I came with the quick batch below that will set different entries : win7, winpe, grub4dos, etc …

You need to edit the batch to set the path to your BCD store.

Beware that the BCD is overwritten each time.

Note that this is greatly (mostly) inspired from this page.


@echo off
setlocal
set BCDEDIT=%SYSTEMROOT%\system32\bcdedit.exe
set BCDSTORE=C:\temp\BCD

del %BCDSTORE% /F

rem create - rem if not needed
%BCDEDIT% /createstore %BCDSTORE%

rem create bootmgr entry
%BCDEDIT% /store %BCDSTORE% /create {bootmgr}
%BCDEDIT% /store %BCDSTORE% /set {bootmgr} description "Boot Manager"
%BCDEDIT% /store %BCDSTORE% /set {bootmgr} device boot
%BCDEDIT% /store %BCDSTORE% /set {bootmgr} timeout 20

ECHO _________________________________________
ECHO BCDEDIT Main Menu
ECHO.
ECHO Menu Choices
ECHO.
ECHO 1 Add Win7
ECHO 2 Add VHDBOOT
ECHO 3 Add Grub4Dos
ECHO 4 Add Winpe
ECHO 5 Add RamDisk
ECHO 6 Add NTLDR
echo -
ECHO 9 Exit
ECHO _________________________________________
ECHO.
SET /P userChoice=ENTER OPTION:

if %userChoice% == 1 GOTO win7
if %userChoice% == 2 GOTO vhdboot
if %userChoice% == 3 GOTO g4d
if %userChoice% == 4 GOTO winpe
if %userChoice% == 5 GOTO ramdisk
if %userChoice% == 6 GOTO ntdlr
if %userChoice% == 9 GOTO QUITMENU

:win7
rem add new windows7 entry
for /f "tokens=2 delims={}" %%g in ('%BCDEDIT% /store %BCDSTORE% /create /application osloader') do set guid={%%g}
%BCDEDIT% /store %BCDSTORE% /set %guid% device partition=C:
%BCDEDIT% /store %BCDSTORE% /set %guid% path \Windows\system32\winload.exe
%BCDEDIT% /store %BCDSTORE% /set %guid% osdevice partition=C:
%BCDEDIT% /store %BCDSTORE% /set %guid% systemroot \Windows
%BCDEDIT% /store %BCDSTORE% /set %guid% description "Windows 7"
%BCDEDIT% /store %BCDSTORE% /displayorder %guid% /addlast
goto :eof

:ntdlr
%BCDEDIT% /store %BCDSTORE% /create {ntldr}
%BCDEDIT% /store %BCDSTORE% /set {ntldr} device partition=C:
%BCDEDIT% /store %BCDSTORE% /set {ntldr} path \ntldr
%BCDEDIT% /store %BCDSTORE% /set {ntldr} description "Windows XP"
%BCDEDIT% /store %BCDSTORE% /displayorder {ntldr} /addlast
goto :eof

:vhdboot
rem add new vhd boot entry
for /f "tokens=2 delims={}" %%g in ('%BCDEDIT% /store %BCDSTORE% /create /application osloader') do set guid={%%g}
%BCDEDIT% /store %BCDSTORE% /set %guid% device vhd=[C:]\disk.vhd
%BCDEDIT% /store %BCDSTORE% /set %guid% path \Windows\system32\winload.exe
%BCDEDIT% /store %BCDSTORE% /set %guid% osdevice vhd=[C:]\disk.vhd
%BCDEDIT% /store %BCDSTORE% /set %guid% systemroot \Windows
%BCDEDIT% /store %BCDSTORE% /set %guid% description "Windows 7 VHDBOOT"
%BCDEDIT% /store %BCDSTORE% /displayorder %guid% /addlast
goto :eof

:g4d
rem add grub4dos
for /f "tokens=2 delims={}" %%g in ('%BCDEDIT% /store %BCDSTORE% /create /application osloader') do set guid={%%g}
%BCDEDIT% /store %BCDSTORE% /set %guid% device boot
%BCDEDIT% /store %BCDSTORE% /set %guid% path \grldr.mbr
%BCDEDIT% /store %BCDSTORE% /set %guid% description "Grub4dos"
%BCDEDIT% /store %BCDSTORE% /displayorder %guid% /addlast
goto :eof

:winpe
rem add winpe
for /f "tokens=2 delims={}" %%g in ('%BCDEDIT% /store %BCDSTORE% /create /application osloader') do set guid={%%g}
%BCDEDIT% /store %BCDSTORE% /set %guid% systemroot \Windows
%BCDEDIT% /store %BCDSTORE% /set %guid% detecthal Yes
%BCDEDIT% /store %BCDSTORE% /set %guid% winpe Yes
%BCDEDIT% /store %BCDSTORE% /set %guid% osdevice ramdisk=[boot]\Boot\boot.wim,{ramdiskoptions}
%BCDEDIT% /store %BCDSTORE% /set %guid% device ramdisk=[boot]\Boot\boot.wim,{ramdiskoptions}
%BCDEDIT% /store %BCDSTORE% /set %guid% description "Windows PE"
%BCDEDIT% /store %BCDSTORE% /displayorder %guid% /addlast
goto :eof

:ramdisk
rem add ramdisk
%BCDEDIT% /store %BCDSTORE% /create {ramdiskoptions}
%BCDEDIT% /store %BCDSTORE% /set {ramdiskoptions} ramdisksdidevice boot
%BCDEDIT% /store %BCDSTORE% /set {ramdiskoptions} ramdisksdipath \Boot\boot.sdi
goto :eof

:eof
echo "this is the end..."

 Posted by at 15 h 54 min
Avr 242014
 

In the previous article, we have seen how to benefit from the new wimboot feature of MS Windows 8.1 using the DISM command.

Thanks to the free/opensource WimLib, let’s now see how we can proceed with the capture/apply phase. This WimLib method will be similar to the DISM one.

Since Wimlib 6.3, you no longer need a Windows 8.1 Update 1 source which means you can use any Winpe 3/4/5 version !

 

Here below the procedure (we assume Win8.1U1 is already installed on C drive):

1-Lets make a WINPE out of  windows (7 or 8) iso/dvd (I use QuickPE) .

2-Boot onto this Winpe (I use rufus to « burn » the winpe iso onto USB).

3-Capture the installation : wimcapture.cmd c:\ e:\install.wim --wimboot
Note : e:\ is a second partition on my hard drive.
Note : wimlib binaries are in x:\extra\wimlib if you used QuickPE.

4-Format C drive (so that we start from a fresh drive)

5-Apply our wim file (from step 3) to my C drive : wimapply.cmd e:\install.wim c:\ --wimboot

Note : before step 5, you may want to perform the following command wimlib-imagex update install.wim 1 --command="add CustomWimBootCompress.ini \Windows\System32\WimBootCompress.ini" in order to fully apply bootmgr files (and not use pointers to the wim file).
Here is the customewimbootcompress.ini.
This applies only if you have one unique boot & system partition which is nowadays rarely the case as Windows always created a hidden/reserved partition for the boot files.

And voila, you should end up with a C drive occupied by only 250 MB (before 1st boot where pagefile.sys and hyberfil.sys will be created).

 Posted by at 21 h 30 min
Avr 222014
 

Discuss it here

Download it here

Latest change log since previous version :

added : can patch the volume serial number (in boot sector)
added : can patch the hidden sectors (in boot sector)
added : can patch heads and secpertrack (in boot sector)
fixed : writing MBR or BS would not work (ressources not saved to current directory)
added : will refresh drives when on DBT_DEVICEARRIVAL/DBT_DEVICEREMOVECOMPLETE
added : generate random serial number (to patch boot sector)
added : create disk will now offer mbr, gpt or raw
fixed : create partition was adding one sector too much
fixed : create unique partition was not wiping partitions above 1st partition.
added : partition editor (using IOCTL_DISK_GET_DRIVE_LAYOUT)
added : delete partition in partition editor
added : create partition in partition editor
added : gpt support in partition editor (using IOCTL_DISK_GET_DRIVE_LAYOUT_ex)
added : gpt support in create partition (using IOCTL_DISK_GET_DRIVE_LAYOUT_ex)
added : gpt support delete partition (using IOCTL_DISK_SET_DRIVE_LAYOUT_ex)
modified : create a GPT partition when there is no partition yet
modified : IOCTL_DISK_GET_DRIVE_LAYOUT_ex before IOCTL_DISK_SET_DRIVE_LAYOUT_ex when deleting/creating a part
added : check disk, next to format using fmifs.dll
added : change partition type
added : change partition boot indicator
added : support for wimboot (windows 8.1 update 1 option)

clonedisk_216

 Posted by at 8 h 44 min
Avr 212014
 

In the previous article, we have seen how to benefit from the new wimboot feature of MS Windows 8.1 : install, capture with wimboot (from winpe), restore with wimboot (from winpe).

CloneDisk now also support wimboot (thru wimgapi.dll) for those who prefer a GUI rather than the DISM command line.

Capturing with the wimboot flag will make it so that the wim file will use a XPRESS chunk size of 4096 (vs 32768) and the image will have the extra flag wimboot.

Some facts :

-My clean install is around 13 GB.

-My wim file is around 7 GB.

-My « wimboot » install occupies « only » 3.5 GB  on drive C. (of which near 3 gigs are taken by hyberfil.sys, pagefile.sys, swapfile.sys)

Discuss it here.

wimboot_1

 Posted by at 21 h 53 min
Avr 122014
 

In April 2014, MS has updated Windows 8.1 to Windows 8.1 Update 1. (buildlab 6.3.9600.17031 and up).

One feature which was not very much marketed was the Windows Image File Boot also named Wimboot.
You can read more here on MS Web site.

In short, here is what MS says :
Windows image file boot (WIMBoot) lets you set up a PC so that it runs directly from a compressed Windows image file (WIM file).
WIMBoot can significantly reduce the amount of space used by Windows files. This helps you provide more free space to users, and helps you manufacture Windows on PCs with smaller drives.

So lets see how we can use this new feature :

We’ll assume you have already installed your Windows 8.1 (You can download an evaluation version here).

1-Lets make a WINPE out of the Windows 8.1 update 1 iso/dvd (I use QuickPE).

2-Boot onto this Winpe (I use rufus to « burn » the winpe iso onto USB).

3-Capture the installation : dism /capture-image /imagefile:e:\install.Wim /capturedir:c:\ /name:install /wimboot
Note here : e:\ is a second partition on my hard drive

4-Format C drive (so that we start from a fresh drive)

5-Apply our wim file (from step 3) to my C drive : dism /apply-image /imagefile:e:\install.Wim /index:1 /applydir:c:\ /wimboot

Note : after step 5, I had to do a bcdboot X:\windows /s X:\ where X is the partition where you just applied your WIM file.
This applies only if you have one unique boot & system partition which is nowadays rarely the case as Windows always created a hidden/reserved partition for the boot files.

And voila, you should end up with a C drive occupied by only 3GB (when it was about 20GB minimum before step 1).

This should work on X86 or X64 (tested), with a UEFI or MBR (tested) partition, with SSD drive or standard drive (not tested).

Here below a picture showing my final / wimboot setup.

wimboot

 Posted by at 22 h 27 min
Avr 112014
 

In a previous article, we have seen how to make a bootable image using Windows API and MS Virtual Disk.

Now, lets do the same but this time we will manipulate bytes in the Drive Master Boot Record and in the Volume Boot Sector with CloneDisk and ImDisk.

1-Create a raw disk image (here test.img=64 MB)

clonedisk_mi1

 

2-Retrieve file size in sectors (here 131072 = (64MB * 1024KB * 1024B) / 512 sectors)

clonedisk_mi2

 

3-Modify partition table : chs end/start=1023/254/63, sectors before=2048, total sectors=129023 (131072-2048-1)

clonedisk_mi3

 

4-Write NT6 mbr

clonedisk_mi31

 

5-Mount disk image (ImDisk auto detect offset=2048, size of disk=129023)

clonedisk_mi32

 

6-Format to NTFS

clonedisk_mi33

 

7-Change Hidden Sectors in Boot Sector  (since it is incorrectly set to 1)

clonedisk_mi4

8-Boot (in qemu or virtualbox)

 

 

 Posted by at 18 h 56 min
Avr 072014
 

Changes since latest changelog

added : set attributes in a wim image
added : can append datas to a wim file
added : support for dynamic VHD’s
added : detach vhd
modified : moved all virtualdisk functions to a new buttonbar
added : create differencing vhd (i.e a vhd with a parent)
added : open vhd in read only mode
added : expand vhd
added : merge vhd
added : reference file for wim capture and wim apply

2.1.0
added : G4D as bootloader next to nt5/nt6
added : manifest to run with admin rights
added : read offline hal/processor details
added : delete offline currentcontrolset\enum key
removed : dump registry (should be another software)
removed : jvdialogs unit

clonedisk210

 Posted by at 11 h 11 min
Avr 072014
 

Latest changelog

fixed : should detect if a socket is already in use
fixed : messages sent from threads would not always reach the memo box
added : will execute an executable/batch if cmd parameter is present in config.ini
fixed : httpd will handle both non keep-alive (default) and keep-alive http requests
fixed : would create crashes (under certain conditions) if the root path was incorrect
fixed : would not start tftpd if not set in config.ini
added : support for dhcp-relay (Thanks to Stefan Smet)

Discuss it here.
Download here.

tps17

 Posted by at 9 h 57 min