AutoHotkey Community

It is currently May 25th, 2012, 9:12 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 44 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject:
PostPosted: November 9th, 2007, 11:40 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Zippo() wrote:
Ran it, got this:
Quote:
Serial Number: ""
Model Number: "1AS "
Revision Number: "7.24"

That's strange. If it's failed to retrieve the SN, the line of Serial Number: should be completely omitted. Would you try again after replacing the MsgBox, ... in the script with the following?
Code:
MsgBox, % (nOff:=NumGet(dd,24,"int")) . " | " . (nOff<>-1 ? """" . DllCall("msvcrt\abs", "int", &dd+nOff, "Cdecl Str") . """" : "")


Quote:
I was looking into IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER after seeing it mentioned in that diskid32.exe link you posted above, but I didn't get a chance today to make a script and test it.

I think IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER is for USB devices only, but I've never actually tried it.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 9th, 2007, 12:41 pm 
Sean wrote:
That's strange. If it's failed to retrieve the SN, the line of Serial Number: should be completely omitted. Would you try again after replacing the MsgBox, ... in the script with the following?


Making that change I get:
Quote:
0 | "("

If that means anything to you :)

Sean wrote:
I think IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER is for USB devices only, but I've never actually tried it.


Yea, but I figure it can't hurt to try. I'll see if I can get it to work on my USB mini stick or something later on today, then try it on the main drive.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 9th, 2007, 2:45 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Zippo() wrote:
Making that change I get:
Quote:
0 | "("

If that means anything to you :)

It indicates the offset of the serial string is 0. I think it should be interpreted as a failure. I was perplexed at the documentation saying the offset will be set to -1 when failure, and I wondered why not 0 which seemed obviously meaningless either. Now your test deepens it more. Maybe a bug of the documentation.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 9th, 2007, 8:12 pm 
After searching some more I came to this Delphi page that looks like it works with both IDE and SCSI:
http://www.delphi3000.com/articles/article_4207.asp?SK=

But in the comment section of that page:
Quote:
But it doesn't work in the server machine. OS : Windows 2003, SCSI RAID Controller


Also looks like a PITA to convert to AHK.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 11th, 2007, 2:29 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Zippo() wrote:
After searching some more I came to this Delphi page that looks like it works with both IDE and SCSI:
http://www.delphi3000.com/articles/article_4207.asp?SK=

That's interesting. It worked in my system with PhysicalDrive0, not with Scsi0:, however, I suppose have to use Scsi0: in your case.

Code:
idxDrv  := 0 ; 1, 2, 3. In SCSI case, may have to use 1 instead of 0.
;sDrive := "\\.\PhysicalDrive" . idxDrv
sDrive  := "\\.\Scsi" . 0 . ":" ; 1, ..., 15

If Not   1 + hDrive:=DllCall("CreateFile", "Uint", &sDrive, "Uint", 0xC0000000, "Uint", 3, "Uint", 0, "Uint", 3, "Uint", 0, "Uint", 0)
   ExitApp

VarSetCapacity(in,28+32,0), VarSetCapacity(out,557)
NumPut(28, in, 0), DllCall("RtlMoveMemory", "Uint", &in+4, "str", "SCSIDISK", "Uint", 8)
NumPut(0x001B0501, in, 16), NumPut(0xEC<<48, in, 32, "int64"), NumPut(idxDrv, in, 40)
If   DllCall("DeviceIoControl", "Uint", hDrive, "Uint", 0x0004D008, "Uint", &in, "Uint", VarSetCapacity(in), "Uint", &out, "Uint", VarSetCapacity(out), "UintP", nReturn, "Uint", 0)   ; IOCTL_SCSI_MINIPORT
   Loop, %   StrLen(str:=DllCall("msvcrt\abs", "int", &out+64, "Cdecl Str"))//2
      SN .= SubStr(str,2*A_Index,1) . SubStr(str,2*A_Index-1,1)
DllCall("CloseHandle", "Uint", hDrive)

MsgBox, % """" . SN . """"


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 15th, 2007, 10:35 am 
Hello Sean i am new can u tell me how we can do this

Code:
OutputvarSN=%SN%
OutputvarMo=%Model%
OutputvarRe=%RN%
if OutputvaSNr = 3JV9HKG9
{
   if OutputvarMo = ST380011A
   {
      if OutputvarRN = 3.06
         Msgbox, Data Verified
      Else
      {
         Msgbox, Invalid Data
         ExitApp
      }
   }
   Else
   {
      Msgbox, Invalid Data
      ExitApp
   }
}
Else
{
   Msgbox, Invalid Data
   ExitApp
}
ExitApp


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 15th, 2007, 2:14 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Anonymous wrote:
can u tell me how we can do this

I guess you're using the second script. Then, replace the line
Code:
   MsgBox, % ((nOff:=NumGet(dd,24,"int"))<>-1 ? "Serial Number:`t""" . DecodeSN(DllCall("msvcrt\abs", "int", &dd+nOff, "Cdecl Str")) . """`n" : "")
      . ((nOff:=NumGet(dd,16)) ? "Model Number:`t""" . DllCall("msvcrt\abs", "int", &dd+nOff, "Cdecl Str") . """`n" : "")
      . ((nOff:=NumGet(dd,20)) ? "Revision Number:`t""" . DllCall("msvcrt\abs", "int", &dd+nOff, "Cdecl Str") . """`n" : "")

with
Code:
     SN:=(nOff:=NumGet(dd,24)) ? DecodeSN(DllCall("msvcrt\abs", "int", &dd+nOff, "Cdecl Str")) : ""
   , MN:=(nOff:=NumGet(dd,16)) ? DllCall("msvcrt\abs", "int", &dd+nOff, "Cdecl Str") : ""
   , RN:=(nOff:=NumGet(dd,20)) ? DllCall("msvcrt\abs", "int", &dd+nOff, "Cdecl Str") : ""
; MsgBox, % SN . "|" . MN . "|" . RN

which stores Serial/Model/Revision Numbers into the variable SN/MN/RN respectively.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 2nd, 2007, 8:28 am 
Sean wrote:
That's interesting. It worked in my system with PhysicalDrive0, not with Scsi0:, however, I suppose have to use Scsi0: in your case.


Been away a while, but still interested in this topic :)

I just ran the script you posted and got this:

Quote:
,,,,


I think I read somewhere that the Vista UAC might be causing problems (filtering some of the information). I ran this as Admin but I'm not sure how that effects the UAC.

I'm going to look for a way to disable UAC completely and then see what happens.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 3rd, 2007, 8:16 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Zippo() wrote:
I just ran the script you posted and got this:

That's too bad. Then, I'm out of idea, except one thing: have you tried after set idxDrv to 1?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 5th, 2007, 3:30 am 
Offline

Joined: May 9th, 2007, 8:13 am
Posts: 45
Code:
idxDrv  := 0 ; 1, 2, 3. In SCSI case, may have to use 1 instead of 0.
;sDrive := "\\.\PhysicalDrive" . idxDrv
sDrive  := "\\.\Scsi" . 0 . ":" ; 1, ..., 15

If Not   1 + hDrive:=DllCall("CreateFile", "Uint", &sDrive, "Uint", 0xC0000000, "Uint", 3, "Uint", 0, "Uint", 3, "Uint", 0, "Uint", 0)
   ExitApp

VarSetCapacity(in,28+32,0), VarSetCapacity(out,557)
NumPut(28, in, 0), DllCall("RtlMoveMemory", "Uint", &in+4, "str", "SCSIDISK", "Uint", 8)
NumPut(0x001B0501, in, 16), NumPut(0xEC<<48, in, 32, "int64"), NumPut(idxDrv, in, 40)
If   DllCall("DeviceIoControl", "Uint", hDrive, "Uint", 0x0004D008, "Uint", &in, "Uint", VarSetCapacity(in), "Uint", &out, "Uint", VarSetCapacity(out), "UintP", nReturn, "Uint", 0)   ; IOCTL_SCSI_MINIPORT
   Loop, %   StrLen(str:=DllCall("msvcrt\abs", "int", &out+64, "Cdecl Str"))//2
      SN .= SubStr(str,2*A_Index,1) . SubStr(str,2*A_Index-1,1)
DllCall("CloseHandle", "Uint", hDrive)

MsgBox, % """" . SN . """"


after running this i get an error:

error: call to non existent function.

specifically: NumPut(28, in, 0), DllCall("RtlMoveMemory", "Uint", &in+4, "str", "SCSIDISK", "Uint", 8)


can anyone tell me what im missing?

thanks


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 5th, 2007, 4:33 am 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8666
Location: Salem, MA
NumPut requires a recent version of AHK. please download a new copy.

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 5th, 2007, 12:38 pm 
Offline

Joined: May 9th, 2007, 8:13 am
Posts: 45
thanks,got it working and tweaked to my needs :).

maybe im going to be a little greedy here, but theres any way to replace numput with something else to get this working with ahk 1.0.46.12?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 5th, 2007, 9:15 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8666
Location: Salem, MA
search the forum for ExtractInteger and ? InsertInteger ? (I don't remember the second one). They are the functions that were used before NumGet and NumPut were made standard. - you will have to alter the parameters a bit, I think.

What's wrong with using the new version?

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 6th, 2007, 6:32 am 
Offline

Joined: May 9th, 2007, 8:13 am
Posts: 45
well,im using close to 200 scripts, and the last time i upgraded i had to rewrite half of them :).

probably my fault,because i was using a really old version that time.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 6th, 2007, 6:39 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8666
Location: Salem, MA
Chris makes a point of not breaking existing scripts whenever possible. You should be largely OK. you can also compile your working old scripts in the old version before upgrading, then you only have to worry if you need to edit the script.

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 44 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: [VxE], dmg, Exabot [Bot], Klark92, MilesAhead, rbrtryn, tomL and 60 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group