You can use the code, sure - that's why I posted it.
A property string may or may not be defined, although I suppose to do not have description sounds odd from a vendor. SetupDiGetDeviceRegistryProperty can return FALSE, as the documentation says: SetupDiGetDeviceRegistryProperty returns the ERROR_INVALID_DATA error code if the requested property does not exist for a device or if the property data is not valid.
The code is resposing well, but it is usefull for file shreding, it uses WriteFile() to overwrite on the file.
For shredding a folder I must search the space of the folder & iterate this procedure for all files, and about the subfolder we need a recursive code to traverse them.
Is there any better solution to wipe a folder of shred a whole drive?
I thinked that the files of the folder could be deleted in this way and finally the empty folder that is not important can be deleted from the system instructions.
This idea is feasible, but the only concern is about the complexity for the huge folders with various subfolders; it is time consuming.
From the other responses presumably the following is what you want to do.
1. You want to shred files.
2. You want to shred file information in the directory itself.
For 1 you iterate over files in the directory and recurse through each sub directory and shred each file. You MUST do this. There is no magic solution that would allow you to do it in some other way.
For 2 it is more complex and depends on what you want you think a 'shred' would do. At a minor level you can just rename each file before shredding it. That overwrites the name. For a real shred you would need to
1. Create an API to access the file system at a raw level
2. Parse the file block
3. Shred the relevant file info that was found by step 1. In this case 'shred' includes the same basic methodology employed to shred a file but on a very small scale. You would need to write the shred code yourself.
Note that if you choose to implement the solution above then you MUST back up your hard drive because when you mess up the code you will need to reformat the hard drive. You must also extensively test this feature as well for the same reason. Also account for different file system types (like ssd and usb.)
PS: Sorry if my answer sounds a bit rude, but I am realy confused about the question what getchar does. If I were you, my first step would be asking google, bing are whatever searchmachine you want. Or taking a look inside a book. If I don't understand the description/answer there, I would ask in a forum again.