[Resolved]gethdinfo not returning driveletters in WinPE
[Resolved]gethdinfo not returning driveletters in WinPE
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.
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.
Last edited by nemesis on Fri Aug 27, 2021 8:29 am, edited 1 time in total.
Re: gethdinfo not returning driveletters in WinPE
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!
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!
-
- Posts: 1682
- Joined: Fri Aug 12, 2011 12:51 am
Re: gethdinfo not returning driveletters in WinPE
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.
You can mount a partition and access it without a drive letter.
Re: gethdinfo not returning driveletters in WinPE
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:
Functions\Disk.inc:
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
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
-
- Posts: 1682
- Joined: Fri Aug 12, 2011 12:51 am
Re: gethdinfo not returning driveletters in WinPE
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).
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:
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:")
Code: Select all
ext("set option locking 1")
Re: gethdinfo not returning driveletters in WinPE
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
Thnx for the example and references
Re: gethdinfo not returning driveletters in WinPE
Hello,
Can you try with GetDrvLtrInfo(1) instead of GetDrvLtrInfo()?
Regards
Can you try with GetDrvLtrInfo(1) instead of GetDrvLtrInfo()?
Regards
Re: gethdinfo not returning driveletters in WinPE
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
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
-
- Posts: 1682
- Joined: Fri Aug 12, 2011 12:51 am
Re: gethdinfo not returning driveletters in WinPE
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
The example is in this thread: viewtopic.php?p=20134#p20134
Re: gethdinfo not returning driveletters in WinPE
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
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