Page 1 of 1
[Resolved]gethdinfo not returning driveletters in WinPE
Posted: Thu Aug 05, 2021 10:01 am
by nemesis
Hi,
I'm unable to see the drive letters in the structure that is returned by gethdinfo.
A test example:
currentDisk = gethdinfo(0)
Printl(currentDisk.partition[4].drvltr)
Partition has the drive letter E in WinPE. Please advise how to retrieve the drive letters.
Is there a way to access the data on the partition without a drive letter btw?
I'd prefer to use the partition GUIDs. However all my attempts up till now have failed. If someone has example on how to do that please let me know.
Re: gethdinfo not returning driveletters in WinPE
Posted: Thu Aug 05, 2021 11:24 am
by nemesis
For the short term I've found a way around it by using:
fsi = fsinfo("E:\")
If fsi Then
printl("FS_SN:", hex(fsi.fs_sn))
printl("FS_VOLNAME:", fsi.fs_volname)
printl("FS_NAME:", fsi.fs_name)
printl("FS_CSIZE:", fsi.fs_csize)
printl("FS_SSIZE:", fsi.fs_ssize)
Else
printl("FSINFO Failed")
End If
Which works as expected. I would however expect my original solution to work as well.
For my current use case this will do however I will have some future use cases where this'll not give me the desired result so any other alternatives would be greatly appriciated!
Re: gethdinfo not returning driveletters in WinPE
Posted: Thu Aug 05, 2021 5:50 pm
by TeraByte Support(PP)
Are you calling getdrvltrinfo() before calling gethdinfo()? This is required to get the drive letters.
You can mount a partition and access it without a drive letter.
Re: gethdinfo not returning driveletters in WinPE
Posted: Fri Aug 06, 2021 6:37 pm
by nemesis
Can you point me to where to find how to mount it?
As for the getdrvltrinfo(), yes I do.
The related parts of the scripting.
Main.tbs:
Code: Select all
// Load the functions
include "Functions\Configuration.inc"
include "Functions\Logging.inc"
include "Functions\Disk.inc"
include "Functions\MenuBuilder.inc"
include "Functions\Terabyte\utility.inc"
Sub main()
If DefaultsLoaded <> 1 Then
printl("Unable to load to load the defaults. This a fatal and unrecoverable error. Please make sure the script base is complete and uncorrputed! Exiting NO ACTIONS taken. Please contact support.")
Else
Initialize()
diskConfig = LoadConfigurationFile("Configuration\disk.conf")
drives = GetDrivesInfo()
systemDisk = IdentifySystemDisk(diskConfig, drives)
InitScreen(systemDisk)
ShowInstallerMainMenu(diskConfig, drives, systemDisk)
Cleanup()
GETKEY()
End If
End Sub
Sub Initialize()
InitializeLogging(LoadConfigurationFile("Configuration\logging.conf"))
LogVerbose("Initializing the scripting", "Installation.tbs(Initialize)")
// Prepares the drive letters for GETHDINFO, this Is active over multiple scripts
getdrvltrinfo()
End Sub
Sub Cleanup()
LogVerbose("Cleaning up after the script", "Installation.tbs(Cleanup)")
// Clears the drive letters for GETHDINFO, this Is active over multiple scripts
getdrvltrinfo(0)
End Sub
Functions\Disk.inc:
Code: Select all
include "Functions\Logging.inc"
include "Functions\Registry.inc"
Sub GetDrivesInfo()
drives = 0
currentDiskNumber = 0
currentDisk = gethdinfo(currentDiskNumber)
While currentDisk
LogVerbose("Adding drive info for disk " # currentDisk.num, "Disk.inc(GetDrivesInfo)")
drives[currentDiskNumber] = currentDisk
currentDiskNumber = currentDiskNumber + 1
currentDisk = gethdinfo(currentDiskNumber)
wend
drives.numberOfDrives = currentDiskNumber
LogVerbose("Number of drives detected is " # drives.numberOfDrives, "Disk.inc(GetDrivesInfo)")
Return drives
End Sub
Re: gethdinfo not returning driveletters in WinPE
Posted: Fri Aug 06, 2021 9:01 pm
by TeraByte Support(PP)
Are you getting the drive letters now? Can't tell from the code you posted since not showing anything with the partitions.
For the mounting, you need to have the disk number and the partition id. Then use ext() to run the TBOSDT command ("mount" or "open fs", manual page 10).
Code: Select all
ext("mount 0: 0 0x01")
// e.g. ext("mount 0: " # hdnum # " " # parid)
// partition's files available using drive 0: in script
ext("umount 0:")
Note that you may also need to use the SET OPTION LOCKING command before mounting if you can't get access to the partition (normal lock or lock with dismount, manual page 28). For example, with normal locking:
Re: gethdinfo not returning driveletters in WinPE
Posted: Mon Aug 09, 2021 6:50 am
by nemesis
Sorry, this is the original code so no. It is not working with the code I posted. Not getting drive letters.
Thnx for the example and references
Re: gethdinfo not returning driveletters in WinPE
Posted: Mon Aug 09, 2021 6:57 am
by Eric
Hello,
Can you try with GetDrvLtrInfo(1) instead of GetDrvLtrInfo()?
Regards
Re: gethdinfo not returning driveletters in WinPE
Posted: Mon Aug 09, 2021 9:08 am
by nemesis
Hi Eric,
thnx for the reply I tried GetDrvLtrInfo(1) as well GetDrvLtrInfo(-1) since according to the documentation they do something. However from the documentation it is not clear to me what they do.
This however made no difference.
Greetz,
Davy
Re: gethdinfo not returning driveletters in WinPE
Posted: Mon Aug 09, 2021 4:27 pm
by TeraByte Support(PP)
Where is the code where you're looking for the drive letters? I don't see anywhere in the code you posted where you're looking at the partitions. The drive letters are for the partitions, not the drives. For example: drives[0].partition[1].drvltr
The example is in this thread:
viewtopic.php?p=20134#p20134
Re: gethdinfo not returning driveletters in WinPE
Posted: Tue Aug 10, 2021 9:46 am
by nemesis
Hi Paul,
Yeah, it works the example as well as my original code. I indeed forgot to include the code where the drive letter is retrieved.
I think the problem might have been between the chair and the keyboard. Sorry, mate and thnx for your help!
Regards, Davy