Hard disk serial
-
Hey all, Trying to retrieve the hd serial through VC++ 6.0, not finding a way to do it. MSDN only had WMI scripting for this, and that's over my head. Is that the only way? Best Regards Fabio Miguez
-
Hey all, Trying to retrieve the hd serial through VC++ 6.0, not finding a way to do it. MSDN only had WMI scripting for this, and that's over my head. Is that the only way? Best Regards Fabio Miguez
Does this help?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
-
Does this help?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
Hey David, Thanks a lot for the link. I am running through the code right now, and a lot of it is foreign to me, but I will see how I can implement this onto my code. I am also having problems compiling, but the .exe available at the site works. I would like to take advantage of the moment to ask if it has to be this complex, getting a serial number for the HD. Is there no function or simpler code able to do it? Thanks again! Best Regards Fabio Miguez
-
Hey David, Thanks a lot for the link. I am running through the code right now, and a lot of it is foreign to me, but I will see how I can implement this onto my code. I am also having problems compiling, but the .exe available at the site works. I would like to take advantage of the moment to ask if it has to be this complex, getting a serial number for the HD. Is there no function or simpler code able to do it? Thanks again! Best Regards Fabio Miguez
GetVolumeInformation - See the lpVolumeSerialNumber field in the data structure. Maybe that is the information you wanted.
-
GetVolumeInformation - See the lpVolumeSerialNumber field in the data structure. Maybe that is the information you wanted.
Hey Blake, Great, it seems I am getting somewhere now. I have implemented it in my test dialog, and lpVolumeNameBuffer and lpFileSystemNameBuffer are correct (the drive name and NTFS were returned properly). The serial number looks good, a 7 digit integer, but when I compare to the serial given by diskid32.exe, the program suggested above, they do not match. The serial on diskid32.exe has a mix of alphanumeric characters. The one I am obtaining using GetVolumeInformation can only be an integer, since the parameter used to store it is a DWORD, and I am formatting it as such: m_sResults.Format("%d", &SerialNumber); Any ideas where I could check the actual disk serial, short of looking on the HD casing? I use a laptop, so that would be a little harder than on a desktop. Thanks again, great help! Best Regards Fabio Miguez
-
Hey Blake, Great, it seems I am getting somewhere now. I have implemented it in my test dialog, and lpVolumeNameBuffer and lpFileSystemNameBuffer are correct (the drive name and NTFS were returned properly). The serial number looks good, a 7 digit integer, but when I compare to the serial given by diskid32.exe, the program suggested above, they do not match. The serial on diskid32.exe has a mix of alphanumeric characters. The one I am obtaining using GetVolumeInformation can only be an integer, since the parameter used to store it is a DWORD, and I am formatting it as such: m_sResults.Format("%d", &SerialNumber); Any ideas where I could check the actual disk serial, short of looking on the HD casing? I use a laptop, so that would be a little harder than on a desktop. Thanks again, great help! Best Regards Fabio Miguez
Fabio Miguez wrote: m_sResults.Format("%d", &SerialNumber); Do you mean to take the address of, rather than the value of,
SerialNumber
?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
-
Fabio Miguez wrote: m_sResults.Format("%d", &SerialNumber); Do you mean to take the address of, rather than the value of,
SerialNumber
?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
Hey Dave, Damn it, you are right, I screwed that one up. But, on removing the & to get the value, not the address, I get a negative number. Perhaps this is happening due to the integer Format I perform? How could I place this value onto m_sResult (a CString) with alphanumeric characters? Thanks again. Best Regards Fabio Miguez
-
Hey all, Trying to retrieve the hd serial through VC++ 6.0, not finding a way to do it. MSDN only had WMI scripting for this, and that's over my head. Is that the only way? Best Regards Fabio Miguez
Fabio, I also needed the information you seek. I downloaded the DiskId32 and also had compile problems; (4) errors. Were you able to get around the compile errors? The *.exe runs fine, but won't recompile under VC++ 6.0... Would appreciate any suggestions you may have. Thanks, Steve.
-
Hey Dave, Damn it, you are right, I screwed that one up. But, on removing the & to get the value, not the address, I get a negative number. Perhaps this is happening due to the integer Format I perform? How could I place this value onto m_sResult (a CString) with alphanumeric characters? Thanks again. Best Regards Fabio Miguez
Fabio Miguez wrote: But, on removing the & to get the value, not the address, I get a negative number. HDD serial numbers/volume IDs are unsigned, and are usually given as hex, so use %x rather than %d (or %u if you want a decimal number).
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
Fabio, I also needed the information you seek. I downloaded the DiskId32 and also had compile problems; (4) errors. Were you able to get around the compile errors? The *.exe runs fine, but won't recompile under VC++ 6.0... Would appreciate any suggestions you may have. Thanks, Steve.
Hey Steve and Ryan, It seems GetVolumeInformation doesn't return the HDD serial, but the "volume" serial, which changes every time you format the HDD (or is the same for cloned HDDs, which a bunch of manufacturers do). Apparently there is no easy way to get HDD serials, short of the complex (to me) code in diskid32. I also found that my number is negative because under Windows, when formatting a drive, the volume serial can be either positive or negative. So you could use this number for copy protection, but if the user passes it on to someone who happens to have the same model of computer (say, the same Dell), this volume serial might be the same. What are the chances? Not great, but this is definitely not the way to go for large scale applications. Microsoft activation, for example, uses the actual HDD serial, among others, probably with code similar to diskid32. My question now is are there any other hardware serials (video card, mobo, memory) that are more easily accessible to begginers like me? Best Regards Fabio Miguez
-
Hey Steve and Ryan, It seems GetVolumeInformation doesn't return the HDD serial, but the "volume" serial, which changes every time you format the HDD (or is the same for cloned HDDs, which a bunch of manufacturers do). Apparently there is no easy way to get HDD serials, short of the complex (to me) code in diskid32. I also found that my number is negative because under Windows, when formatting a drive, the volume serial can be either positive or negative. So you could use this number for copy protection, but if the user passes it on to someone who happens to have the same model of computer (say, the same Dell), this volume serial might be the same. What are the chances? Not great, but this is definitely not the way to go for large scale applications. Microsoft activation, for example, uses the actual HDD serial, among others, probably with code similar to diskid32. My question now is are there any other hardware serials (video card, mobo, memory) that are more easily accessible to begginers like me? Best Regards Fabio Miguez
Fabio, Are you trying to lock to a specific computer? In that case, use multiple hardware keys and multiple system metrics and allow the program to work if a 'majority' of them are met. Use hard drive volume numbers, get the MAC address of the network card if there is a network card, use a hash of monitor type name, you could look up modem manufacturer or modem type, memory quantity, sound card manufacturer or type, etc. You save all these bits of information somewhere, and when you do your check, you allow it to be successful if several of the items are still valid (for example, user might have temporarily used a different monitor, but it is unlikely they constantly add or remove memory or change hard drives around). This way, you are not dependnet upon one single bit of information that might change, and as a result, constantly issuing new keys to your users unecessarily.
-
Fabio, Are you trying to lock to a specific computer? In that case, use multiple hardware keys and multiple system metrics and allow the program to work if a 'majority' of them are met. Use hard drive volume numbers, get the MAC address of the network card if there is a network card, use a hash of monitor type name, you could look up modem manufacturer or modem type, memory quantity, sound card manufacturer or type, etc. You save all these bits of information somewhere, and when you do your check, you allow it to be successful if several of the items are still valid (for example, user might have temporarily used a different monitor, but it is unlikely they constantly add or remove memory or change hard drives around). This way, you are not dependnet upon one single bit of information that might change, and as a result, constantly issuing new keys to your users unecessarily.
Hey Blake, Yeah, trying to lock it to a certain machine. The idea behind the HDD serial was that would stop the user from copying the program to another HDD, and also allow him to change whatever hardware he needed on the machine (video card, monitor, etc.) without having to request a new key. If he changed HDDs, then he would need a new key. But I have been frustrated by how seemingly complex it has been to retrieve the HDD serial, so I am open to other ideas. Your suggestion is very good, but I don't know how to retrieve any of the information you mentioned. I have not yet searched for it (at work, not much time right now), but do you know of any offhand? Thanks a ton. Best Regards Fabio Miguez