Page 2 of 2

Posted: Sat Mar 06, 2004 3:17 pm
by blueznl
is there an update on this... or even better, has the source been released?

Posted: Sat Mar 06, 2004 5:19 pm
by Num3
Here's a quote from the original library, maybe it helps...

The source code for the DLL mentioned is freeware and available on the site, maybe someone can built an internal library for Purebasic, would be nice.

There has also been an update on the 25th November 2003 :P
Included in this archive is an example of how to use these functions in PureBasic. This library was created in 100% C, and originated from the DiskId32 utility by WinSim Inc. (http://www.winsim.com/diskid32/diskid32.html). This library is freeware! This file must be included unaltered if you plan to redistribute the library.

Posted: Sat Mar 06, 2004 6:21 pm
by Shannara
I second that, either an internal library for purebasic or a regular library (not dll) for linux and windows.

Posted: Fri Mar 12, 2004 1:02 pm
by DoubleDutch
If your using the HD serial number with a protection scheme, its best NOT to use the external DLL as it can simply be replaced by something faking the serial number.

Find a way to incorperate the check into your own code if using it for protection. :!:

Revisiting This

Posted: Thu Jun 09, 2005 6:54 pm
by Straker
Hi All,

I am posting on this topic because it is ALMOST what I need.

1) The links that Revolver for his library posted are no longer valid. Has/Can anyone mirror those if you downloaded them in 2003?

2) Revolver hasn't posted since 2003, so I don't even know if he is around anymore.

Here is what I am looking for:

This code works fine for finding HD Info/Serial number for Win98/Win2k/WinXP, however, you must be admin on Win2K/WinXP. I need this code for non-admins on Win2K/WinXP - does anyone have this?

More specifically, has anyone converted DISKID32 (see http://www.winsim.com/diskid32/diskid32.html) to PureBasic code?


Also, I am looking for this in PureBasic source code, no external DLLs as I need to compile it into my own EXE.

Anyone? Thanks in advance?

Here is the related link with similar code by Rings (again with the same issues regarding Admin on Win2K/WinXP):
viewtopic.php?p=28162#28162

Posted: Fri Jun 10, 2005 2:59 pm
by blueb
Straker,

Found this in my folder of "Handy Files" (don't know who wrote it, but came from the forum).

Code: Select all

Structure IDEREGS 
    bFeaturesReg.b 
    bSectorCountReg.b 
    bSectorNumberReg.b 
    bCylLowReg.b 
    bCylHighReg.b 
    bDriveHeadReg.b 
    bCommandReg.b 
    bReserved.b 
EndStructure 
Structure SENDCMDINPARAMS 
    cBufferSize.l 
    irDriveRegs.IDEREGS 
    bDriveNumber.b 
    bReserved.b[3] 
    dwReserved.l[4] 
EndStructure 

Structure  DRIVERSTATUS 
    bDriveError.b 
    bIDEStatus.b 
    bReserved.b[2] 
    dwReserved.l[2] 
EndStructure 
Structure  SENDCMDOUTPARAMS 
    cBufferSize.l 
    DStatus.DRIVERSTATUS      
    bBuffer.b[512] 
EndStructure 


#DFP_RECEIVE_DRIVE_DATA = $7C088 

bin.SENDCMDINPARAMS 
bout.SENDCMDOUTPARAMS 



Procedure.s ChangeHighLowByte(Instring.s) 
;Change BIG-Little Endian 
sdummy.s="" 
L=Len(Instring) 
For I=1 To L Step 2 
If (I+1)<=L 
  sdummy.s=sdummy.s + Mid(Instring,I+1,1)+Mid(Instring,I,1)  
EndIf 
Next I 
ProcedureReturn sdummy.s 
EndProcedure 

;*****************************************************************
    mvarCurrentDrive=1 ;If you have more hard-disks change it here 
;*****************************************************************

hdh = CreateFile_("\\.\PhysicalDrive" + Str(mvarCurrentDrive),#GENERIC_READ | #GENERIC_WRITE, #FILE_SHARE_READ | #FILE_SHARE_WRITE,0, #OPEN_EXISTING, 0, 0) 
If hdh  
        bin\bDriveNumber = mvarCurrentDrive 
        bin\cBufferSize = 512 
        
        If (mvarCurrentDrive & 1) 
          bin\irDriveRegs\bDriveHeadReg = $B0 
        Else 
          bin\irDriveRegs\bDriveHeadReg = $A0 
        EndIf 
        bin\irDriveRegs\bCommandReg = $EC 
        bin\irDriveRegs\bSectorCountReg = 1 
        bin\irDriveRegs\bSectorNumberReg = 1 
    
       br=0 
       Result=DeviceIoControl_( hdh, #DFP_RECEIVE_DRIVE_DATA, bin, SizeOf(SENDCMDINPARAMS), bout, SizeOf(SENDCMDOUTPARAMS), @br, 0) 
       If br>0 
        hddfr = 55:hddln = 40          : 
        Modell.s=ChangeHighLowByte(PeekS(@bout\bBuffer[0]+hddfr-1 ,hddln  ) ) 
        hddfr = 21:hddln = 20          : 
        Serial.s=Trim(ChangeHighLowByte(PeekS(@bout\bBuffer[0]+hddfr-1 ,hddln  ) )) 
        hddfr = 47:hddln = 8          
        Firmware.s=ChangeHighLowByte(PeekS(@bout\bBuffer[0]+hddfr-1 ,hddln  ) ) 
        MessageRequester("Info about your harddisk","Vendor & Model Number = "+Modell.s + Chr(13) +"Serial Number = "+Serial.s+ Chr(13)+"Firmware Version = "+Firmware ,0) 
       EndIf 
Else 
  Beep_(100,100) 
EndIf 
(Works for me on Win XP Pro (I've got admin rights, but I don't see where it would stall, if you didn't)

Hope it helps,
--blueb

Posted: Fri Jun 10, 2005 6:23 pm
by Straker
blueb - thanks for taking the time to respond.

Unfortunately that code doesn't work on W2K/WXP unless you are an admin. I want to include code that can be used by non-admins as well to see this info.

Thanks again.