Weird Problem when Cloning

  • Thread starter Thread starter Richard
  • Start date Start date
R

Richard

I ended up using DD on Linux to clone my Compact Flashed and it works pretty
good. I have one issue though, and it does this regardless which method I
use to clone the CF.

When I say Clone, I have one Master "Golden" CF which is totally complete
and tested. Final Image.

Problem.

I run an Advantech board and Advantech has a setup program called
AdvLMSensor with installs some sort of hook in the system. my shell grabs
the CPU and Motherboard temps, processes the infor to turn on a fan and
such.

Problem is, after making a duplicate image, this does not work and I always
have to uninstall and reinstall AdvLmSensor to get it working again. I've
even tried it on the "same" SBC to see if it was an SBC Issue.

For some reason, it can never get the handle from the file below. Any ideas
why?

See below for code snippet;

My Shell does this to get the temps:

Procedure TMain.GetTemps;
begin
hLMSensor := CreateFile('\\.\AdvLmDev',
GENERIC_WRITE,
FILE_SHARE_WRITE,
Nil,
OPEN_EXISTING,
0,
0,);

If (hLMSensor = INVALID_HANDLE_VALUE) then
Begin
Showmessage('Unable to get handle from LMSensor');
Exit;
End Else
Begin
iF DeviceIOControl(hLMSensor,
IOCTL_LMSENSOR_GET_TEMP,
NIL,0,
@temp[0],SizeOf(Temp),
Ret,
NIL) THEN
Begin
PTempC := Temp[1]/10;
MBTempC := Temp[2] / 10;
PTempF := 32 + PTempC * 9 /5;
MBTempF := 32 + MBTempC * 9 /5;
ProcTempLabel.Caption := FloatToStrF(PTempC,ffFixed,6,1)+ 'C / '+
FloatToStrF(PTempF,ffFixed,6,1)+ 'F ';
MBTempLabel.Caption := FloatToStrF(MBTempC,ffFixed,6,1)+ 'C / ' +
FloatToStrF(MBTempF,ffFixed,6,1)+ 'F ';

SendInfo(CPUTempMsg, Round(PTempF));
SendInfo(MBTempMsg, Round(MBTempF));

End Else
Begin
ProcTempLabel.Caption := '0.00';
MBTempLabel.Caption := '0.00';
End;
CloseHandle(hLMSensor);
End;
 
Hi Richard,

Please use following procedure.
1. Delete setupapi.log from your golden image.
2. Copy XPe to second CF.
3. Boot XPe.
4. Send us here setupapi.log or examine it yourself. (It should be empty if there is no hardware differences found)

Regards,
Slobodan
 
Here it is, no idea what is going on if it's good, bad, or normal...\

[SetupAPI Log]
OS Version = 5.1.2600
Platform ID = 2 (NT)
Service Pack = 0.0
Suite = 0x0140
Product Type = 1
Architecture = x86
[2004/10/26 13:50:29 356.3 Driver Install]
#-019 Searching for hardware ID(s):
ide\disksandisk_sdcfb-256_______________________hdx_2.15,ide\sandisk_sdcfb-2
56_______________________hdx_2.15,ide\disksandisk_sdcfb-256_________________
______,sandisk_sdcfb-256_______________________hdx_2.15,gendisk
#-018 Searching for compatible ID(s): gendisk
#-198 Command line processed: C:\WINDOWS\system32\services.exe
#I022 Found "GenDisk" in C:\WINDOWS\inf\disk.inf; Device: "Disk drive";
Driver: "Disk drive"; Provider: "Microsoft"; Mfg: "(Standard disk drives)";
Section name: "disk_install".
#I023 Actual install section: [disk_install.NT]. Rank: 0x00000004. Effective
driver date: 07/01/2001.
#-166 Device install function: DIF_SELECTBESTCOMPATDRV.
#I063 Selected driver installs from section [disk_install] in
"c:\windows\inf\disk.inf".
#I320 Class GUID of device remains: {4D36E967-E325-11CE-BFC1-08002BE10318}.
#I060 Set selected driver.
#I058 Selected best compatible driver.
#-166 Device install function: DIF_INSTALLDEVICEFILES.
#I124 Doing copy-only install of
"IDE\DISKSANDISK_SDCFB-256_______________________HDX_2.15\4&8888BFD&0&0.1.0"
..
#-166 Device install function: DIF_REGISTER_COINSTALLERS.
#I056 Coinstallers registered.
#-166 Device install function: DIF_INSTALLINTERFACES.
#-011 Installing section [disk_install.NT.Interfaces] from
"c:\windows\inf\disk.inf".
#I054 Interfaces installed.
#-166 Device install function: DIF_INSTALLDEVICE.
#I123 Doing full install of
"IDE\DISKSANDISK_SDCFB-256_______________________HDX_2.15\4&8888BFD&0&0.1.0"
..
#W100 Query-removal during install of
"IDE\DISKSANDISK_SDCFB-256_______________________HDX_2.15\4&8888BFD&0&0.1.0"
was vetoed by
"IDE\DiskSanDisk_SDCFB-256_______________________HDX_2.15\4&8888bfd&0&0.1.0"
(veto type 6: PNP_VetoDevice).
#W104 Device
"IDE\DISKSANDISK_SDCFB-256_______________________HDX_2.15\4&8888BFD&0&0.1.0"
required reboot: Query remove failed (install) CfgMgr32 returned: 0x17:
CR_REMOVE_VETOED.
#I121 Device install of
"IDE\DISKSANDISK_SDCFB-256_______________________HDX_2.15\4&8888BFD&0&0.1.0"
finished successfully.
[2004/10/26 13:50:34 356.8 Driver Install]
#-019 Searching for hardware ID(s): storage\volume
#-198 Command line processed: C:\WINDOWS\system32\services.exe
#I022 Found "STORAGE\Volume" in C:\WINDOWS\inf\volume.inf; Device: "Generic
volume"; Driver: "Generic volume"; Provider: "Microsoft"; Mfg: "Microsoft";
Section name: "volume_install".
#I023 Actual install section: [volume_install]. Rank: 0x00000000. Effective
driver date: 07/01/2001.
#-166 Device install function: DIF_SELECTBESTCOMPATDRV.
#I063 Selected driver installs from section [volume_install] in
"c:\windows\inf\volume.inf".
#I320 Class GUID of device remains: {71A27CDD-812A-11D0-BEC7-08002BE2092F}.
#I060 Set selected driver.
#I058 Selected best compatible driver.
#-166 Device install function: DIF_INSTALLDEVICEFILES.
#I124 Doing copy-only install of
"STORAGE\VOLUME\1&30A96598&0&SIGNATURE3DB63DB5OFFSET4000LENGTHF4BC000".
#-166 Device install function: DIF_REGISTER_COINSTALLERS.
#I056 Coinstallers registered.
#-166 Device install function: DIF_INSTALLINTERFACES.
#-011 Installing section [volume_install.Interfaces] from
"c:\windows\inf\volume.inf".
#I054 Interfaces installed.
#-166 Device install function: DIF_INSTALLDEVICE.
#I123 Doing full install of
"STORAGE\VOLUME\1&30A96598&0&SIGNATURE3DB63DB5OFFSET4000LENGTHF4BC000".
#W100 Query-removal during install of
"STORAGE\VOLUME\1&30A96598&0&SIGNATURE3DB63DB5OFFSET4000LENGTHF4BC000" was
vetoed by
"STORAGE\Volume\1&30a96598&0&Signature3DB63DB5Offset4000LengthF4BC000" (veto
type 6: PNP_VetoDevice).
#W104 Device
"STORAGE\VOLUME\1&30A96598&0&SIGNATURE3DB63DB5OFFSET4000LENGTHF4BC000"
required reboot: Query remove failed (install) CfgMgr32 returned: 0x17:
CR_REMOVE_VETOED.
#I121 Device install of
"STORAGE\VOLUME\1&30A96598&0&SIGNATURE3DB63DB5OFFSET4000LENGTHF4BC000"
finished successfully.








Slobodan Brcin (eMVP) said:
Hi Richard,

Please use following procedure.
1. Delete setupapi.log from your golden image.
2. Copy XPe to second CF.
3. Boot XPe.
4. Send us here setupapi.log or examine it yourself. (It should be empty
if there is no hardware differences found)
 
Hi Richard,

For some strange reason PnP see different CF. (Either type, size or serial number)

You can see this from regedit by examining entries in gold image and cloned image:
HKLM\System\CurrentControlSet\Enum\IDE\?????YourDisk?????\???YourDiskUniqueNumber????

One question: Do you use MS cloning support component? Don't use it while trying to solve this problem.

I have never used AdvLMSensor but it might be for some weird reason be locked to some MB value or CF number and prevent its
functionality.
Try using cloned image on same MB that you used with master CF that was working. (Let us know about the results.).

BTW: Can you use WMI like Win32_TemperatureProbe ?
http://groups.google.com/groups?hl=en&lr=&c2coff=1&q=Win32_TemperatureProbe&meta=

Regards,
Slobodan

Richard said:
Here it is, no idea what is going on if it's good, bad, or normal...\

[SetupAPI Log]
OS Version = 5.1.2600
Platform ID = 2 (NT)
Service Pack = 0.0
Suite = 0x0140
Product Type = 1
Architecture = x86
[2004/10/26 13:50:29 356.3 Driver Install]
#-019 Searching for hardware ID(s):
ide\disksandisk_sdcfb-256_______________________hdx_2.15,ide\sandisk_sdcfb-2
56_______________________hdx_2.15,ide\disksandisk_sdcfb-256_________________
______,sandisk_sdcfb-256_______________________hdx_2.15,gendisk
#-018 Searching for compatible ID(s): gendisk
#-198 Command line processed: C:\WINDOWS\system32\services.exe
#I022 Found "GenDisk" in C:\WINDOWS\inf\disk.inf; Device: "Disk drive";
Driver: "Disk drive"; Provider: "Microsoft"; Mfg: "(Standard disk drives)";
Section name: "disk_install".
#I023 Actual install section: [disk_install.NT]. Rank: 0x00000004. Effective
driver date: 07/01/2001.
#-166 Device install function: DIF_SELECTBESTCOMPATDRV.
#I063 Selected driver installs from section [disk_install] in
"c:\windows\inf\disk.inf".
#I320 Class GUID of device remains: {4D36E967-E325-11CE-BFC1-08002BE10318}.
#I060 Set selected driver.
#I058 Selected best compatible driver.
#-166 Device install function: DIF_INSTALLDEVICEFILES.
#I124 Doing copy-only install of
"IDE\DISKSANDISK_SDCFB-256_______________________HDX_2.15\4&8888BFD&0&0.1.0"
.
#-166 Device install function: DIF_REGISTER_COINSTALLERS.
#I056 Coinstallers registered.
#-166 Device install function: DIF_INSTALLINTERFACES.
#-011 Installing section [disk_install.NT.Interfaces] from
"c:\windows\inf\disk.inf".
#I054 Interfaces installed.
#-166 Device install function: DIF_INSTALLDEVICE.
#I123 Doing full install of
"IDE\DISKSANDISK_SDCFB-256_______________________HDX_2.15\4&8888BFD&0&0.1.0"
.
#W100 Query-removal during install of
"IDE\DISKSANDISK_SDCFB-256_______________________HDX_2.15\4&8888BFD&0&0.1.0"
was vetoed by
"IDE\DiskSanDisk_SDCFB-256_______________________HDX_2.15\4&8888bfd&0&0.1.0"
(veto type 6: PNP_VetoDevice).
#W104 Device
"IDE\DISKSANDISK_SDCFB-256_______________________HDX_2.15\4&8888BFD&0&0.1.0"
required reboot: Query remove failed (install) CfgMgr32 returned: 0x17:
CR_REMOVE_VETOED.
#I121 Device install of
"IDE\DISKSANDISK_SDCFB-256_______________________HDX_2.15\4&8888BFD&0&0.1.0"
finished successfully.
[2004/10/26 13:50:34 356.8 Driver Install]
#-019 Searching for hardware ID(s): storage\volume
#-198 Command line processed: C:\WINDOWS\system32\services.exe
#I022 Found "STORAGE\Volume" in C:\WINDOWS\inf\volume.inf; Device: "Generic
volume"; Driver: "Generic volume"; Provider: "Microsoft"; Mfg: "Microsoft";
Section name: "volume_install".
#I023 Actual install section: [volume_install]. Rank: 0x00000000. Effective
driver date: 07/01/2001.
#-166 Device install function: DIF_SELECTBESTCOMPATDRV.
#I063 Selected driver installs from section [volume_install] in
"c:\windows\inf\volume.inf".
#I320 Class GUID of device remains: {71A27CDD-812A-11D0-BEC7-08002BE2092F}.
#I060 Set selected driver.
#I058 Selected best compatible driver.
#-166 Device install function: DIF_INSTALLDEVICEFILES.
#I124 Doing copy-only install of
"STORAGE\VOLUME\1&30A96598&0&SIGNATURE3DB63DB5OFFSET4000LENGTHF4BC000".
#-166 Device install function: DIF_REGISTER_COINSTALLERS.
#I056 Coinstallers registered.
#-166 Device install function: DIF_INSTALLINTERFACES.
#-011 Installing section [volume_install.Interfaces] from
"c:\windows\inf\volume.inf".
#I054 Interfaces installed.
#-166 Device install function: DIF_INSTALLDEVICE.
#I123 Doing full install of
"STORAGE\VOLUME\1&30A96598&0&SIGNATURE3DB63DB5OFFSET4000LENGTHF4BC000".
#W100 Query-removal during install of
"STORAGE\VOLUME\1&30A96598&0&SIGNATURE3DB63DB5OFFSET4000LENGTHF4BC000" was
vetoed by
"STORAGE\Volume\1&30a96598&0&Signature3DB63DB5Offset4000LengthF4BC000" (veto
type 6: PNP_VetoDevice).
#W104 Device
"STORAGE\VOLUME\1&30A96598&0&SIGNATURE3DB63DB5OFFSET4000LENGTHF4BC000"
required reboot: Query remove failed (install) CfgMgr32 returned: 0x17:
CR_REMOVE_VETOED.
#I121 Device install of
"STORAGE\VOLUME\1&30A96598&0&SIGNATURE3DB63DB5OFFSET4000LENGTHF4BC000"
finished successfully.








Slobodan Brcin (eMVP) said:
Hi Richard,

Please use following procedure.
1. Delete setupapi.log from your golden image.
2. Copy XPe to second CF.
3. Boot XPe.
4. Send us here setupapi.log or examine it yourself. (It should be empty
if there is no hardware differences found)
Regards,
Slobodan
 
Nope, I double checked and System Cloning is not part of the Image.
However, I did take CF from one machine to another machine and it still
works, so it's not machine specific.

Richard

Slobodan Brcin (eMVP) said:
Hi Richard,

For some strange reason PnP see different CF. (Either type, size or serial number)

You can see this from regedit by examining entries in gold image and cloned image:
HKLM\System\CurrentControlSet\Enum\IDE\?????YourDisk?????\???YourDiskUniqueN
umber????

One question: Do you use MS cloning support component? Don't use it while trying to solve this problem.

I have never used AdvLMSensor but it might be for some weird reason be
locked to some MB value or CF number and prevent its
functionality.
Try using cloned image on same MB that you used with master CF that was
working. (Let us know about the results.).
 
Then only one thing remain to be seen like I already mentioned.
You will have to determine reason why PnP detect new disk after the cloning.
Only reason for this is that serial number changed (since you ruled out possibility that controller is changed).
Or that you are using different types of CF.
Use regedit and do manual comparation of what happens when new CF is detected.

Regards,
Slobodan
 
Got it, I'm not a Linux guy but I was coping the first partition instead of
the entire disk. Now it works.

Thanks,
Richard


Slobodan Brcin (eMVP) said:
Then only one thing remain to be seen like I already mentioned.
You will have to determine reason why PnP detect new disk after the cloning.
Only reason for this is that serial number changed (since you ruled out
possibility that controller is changed).
 
Richard,

It's good that you have solved your problem, but....

As another option for cloning you could write your own clone program for
windows.
I see by your questions in the thread you have no problems writing code that
uses CreateFile in the C runtime.
You do know that CreateFile will allow you to open a PHYSICAL disk device.
This device dosen't even need to be formated. It's a fairly simple program
to write that will open a PHYSICAL device (by number) and do reads and
writes to physical sectors. I've written several MFC dialog based programs
that allow me to read as many sectors as I want and write them to a file..
and write from the file back to a device... Instant Clone :-)

FYI this works on ANY standard disk device, I've done it toUSB memory, and
hard disks too...

If you want to be really classy there is a call that will unmount the device
(if it had a valid format) and another call that will mount it, so if you
wrap your write code with these the newly "formatted" device will show up
with a disk letter.

Dave
 
Thanks Dave,

Unfortunately, I have too much on my plate right now to design one from
scratch not doing before. I may be able to convert a working example, but
to research , learn, and debug one right at the moment. That is why I
elected to do a one stop fix with Linux and DD.

Eventually, I would like a pure XP solution. Care to donate any examples?

Richard
 
Hi Richard,

Making this work is very easy.
Making this work universally would require some time.

I think that we already put some code throughout this NG and guides what IOCTL functions should be used.

Regards,
Slobodan
 
Richard,

I'll see if I have a chunk of code around I can make available.

But honestly it's no different than opening a file and reading/writing to
it.
IIRC the only caviet is that you should write in 'sector' sizes I.E. 512
bytes at a time.
If you have time take a quick look at the documentation on CreateFile and
you'll see how to open a physical device... the FileName is just
\\.\PHYSICALDRIVEx where the "x" is the drive number..

As for the IOCTLS Slobodan is refering to, you don't even need those if you
hack out a program that just takes the physical device number, and then just
use "Disk Manager" in "Computer Managment" to find out your device number
:-)

And yes I understand why you went the 'nix/DD route, I just got tired of
walking across the room to plug the CF's in. I've got a PuTTY SSH session
running all the time to my 'nix box :-)

Dave
 
Hi Dave,

I guess that there were two threads created covering same topic:
Here is my reply in "CF Mass Production Thread":

For your case this are most of functions that you will need:

CreateFile
ReadFile
WriteFile
CloseHandle
DeviceIoControl
FSCTL_LOCK_VOLUME
FSCTL_DISMOUNT_VOLUME
IOCTL_DISK_GET_LENGTH_INFO
CM_Request_Device_Eject
SetupDiEnumDeviceInfo
SetupDiGetClassDevs
SetupDiDestroyDeviceInfoList

Fairly simple to use and write. Especially this is true because you have medium that is marked as removable because of
hardware/software implementation (If I remember correctly)

Regards,
Slobodan
 
Slobodan,

Yeah I guess there are 2 threads going on this...

Yep those are the functions ya need, and you don't REALLY need anything more
than the CreatFile/Read/Write/Close unless you are doing a classy program
(which I did once for a client). Maxium Shatskih over in
....development.device.drivers clued me to the IOCLTS... :-)

Dave
 
Yep those are the functions ya need, and you don't REALLY need anything more
than the CreatFile/Read/Write/Close unless you are doing a classy program

Yup but only if disk was without valid FS, otherwise there could be problems with data integrity.

Anyhow classy program is required if you don't want to be on vigilance of using wrong disk number (very bad thing).
I prefer letting program do the thinking stuff instead of me :-)

Regards,
Slobodan
 
Back
Top