ps2homebrew / hdl-dump

Install games in HDLoader format to APA-formatted hard drive
123 stars 25 forks source link

[ISSUE]: HDD Identifier 'hdd#:' is unsafe, use a more direct identifier instead #63

Open rlaphoenix opened 1 year ago

rlaphoenix commented 1 year ago

Checks

Describe the issue

Using a numbered upon scan as an identifier is incredibly unsafe. If your system has changed in it's array of available drives, that number would have changed on the next CLI call.

While it wouldn't happen often, if you scan for drives, choose let's say hdd4: and then remove an HDD (let's say an external HDD), hdd4: may change to being hdd3:, so specifying hdd4: for the next call would be for a different drive. This would be disastrous if that now refers to a non-PS2 HDD. Even if there are checks in place.

If hdl-dump ever had a format HDD command, or such like it, it could be seriously disastrous.

It also becomes even more problematic when GUI wrappers to hdl-dump begin to be used. Especially in scenarios where long batch installations would be done. E.g., imagine batch query, cdvdinfo2, and finally an inject* call, via a batch ISO file list. Someone let it run in the background and bam! they eject a drive. Now their work E:/ drive is being used, or the program will fail, or something disastrous happens.

Console model

SCPH-30003 R

AKuHAK commented 1 year ago

I agree that switch to UNC paths is safer, as always PRs are welcome, but I have one question. Are you sure that you have SCPH-30009R console? Such model does not exist.

rlaphoenix commented 1 year ago

I agree that switch to UNC paths is safer, as always PRs are welcome, but I have one question. Are you sure that you have SCPH-30009R console? Such model does not exist.

I'm not familiar enough with the codebase nor C/C++ in general to do this. But yeah, UNC or something would be better. Even still though, depending which UNC path you use, it can still be indirect. \\.\PHYSICALDRIVE# is indirect still (but maybe Windows has things to deal with this? not sure) but \\.\D: could work.

I've fixed the model number.

israpps commented 1 year ago

9 is china

Wasn't SCPH-50009 the first chinese model? aka: Sony Lab Rat lol

During my journey coding hdl batch installer i've seen that numbered HDDs don't change that easy

example: hdd4: is the PS2 HDD but hdd3: is a thumb drive

after removing the thumb drive the HDD remained as hdd4:

not sure if it was a coincidence, but i can confirm that it behaves that way for me