Archive: state all local drives


state all local drives
Does anyone know how I can find out the root dir of all local drives on a machine. It would be best if it returned one at a time in the format (c:\) in a variable and then you add 1 to another variable send it to the top again and it would do the second one - or something like that.
Any ideas?
Thanks


Download the latest NSIS 2 snapshot at http://nsis.sf.net and check out the System plugin example.


The DriveInfo plugin by KiCHiK might be of interest to you, get it on this page: http://nsis.sourceforge.net/archive/download.php


Download the latest NSIS 2 snapshot at http://nsis.sf.net and check out the System plugin example.
I can't find anything in the system DLL that would work - which bit of it were you meaning.


The DriveInfo plugin by KiCHiK might be of interest to you, get it on this page: http://nsis.sourceforge.net/archive/download.php
That works the other way around - or am I wrong. I thought you gave it a drive letter and it gave you info about it.

I was looking for something like the 'Enumerate cd drives' polugin which worked for F.D.Ds. H.D.Ds. C.Ds. D.V.Ds. Zip Drives etc.

Joost was talking about <NSIS directory>\Contrib\System\System.nsi lines 28 - 68. It gets the free space for all drives on the system. You can remove the free space part and you'll have a normal enumeration.


problem,
I get an illegal operation error whenever I run a program using the systemDLL. Any ideas what is wrong?


Are you running the original example or have you changed it?


problem,
I get an illegal operation error whenever I run a program using the systemDLL. Any ideas what is wrong?


What OS are you using? Which version of NSIS? What examples have you tried? What's the exact error you get?


The system example which comes with NSIS gives me one blue screen after another. With my own ones:

System::Call '${sysGetLogicalDriveStrings}(1024, r1)'

System::Call '${sysGetDiskFreeSpaceEx}(i r1, .r3, .r4, .r5)'

System::Call '${syswsprintf} (.r7, "%s%20s %20s mb %20s mb %20s mb$\n", tr7, tr6, ts, ts, ts)'


gives me an illegal operation however:

System::Call '*$R0${stSYSTEMTIME} (.r1, .r2, .r3, .r4, .r5, .r6, .r7, .r8)'

System::Call "*$1(i .r2, &t10 .r3, &i1 .r4, &i2 .r5, &l0 .r6)"

System::Call 'user32::MessageBoxA(i $HWNDPARENT, t "Just direct MessageBoxA specification demo ;)", t "System Example 3", i 33) i.s'

are all fine.


Sorry about the second post of the same message. I was in my history looking for this post, and clicked the link for newreply.php instead of showthread.php, and so posted my message again.

I am using Win95 4.00.950.a
NSIS 1.9
I posted examples before I saw your last post.
The error mesage is:

This program has performed an illegal opperation and will be shut down.

If the problem persists, contact the program vendor.

Details>>

DRIVES caused an invalid page fault in module SYSTEM.DLL at 0137:1000laca
Registers:
EAX=00001310 CS=1037 EIP=1000laca EFLGS=00010246
EBX=bff76dfl SS=013f ESP=0065f3c0 EBP=0065f3fc
ECX=0065ff68 DS=013f ESI=00000000 FS=3d07
EDX=00000000 ES=013f EDI=00430888 GS=3a76
Bytes at CS:EIP:
39 10 59 74 14 8b ce 8b 30 8d 86 10 13 00 00 39
Stack dump:
00000000 1000267f 00425360 0040ac58 0043047c
00000000 00430078 00000000 00530b8f 00000001
00530b80 00000000 00000001 0043048b 00000000
0065f428


Sounds to me like another bug.
Anyway, it shouldn't be possible to crash someone's PC with wrong scripting.


Originally posted by virtlink Sounds to me like another bug.
You always seem to enjoy pointing them out, I can't help but wonder why? The CVS and other recent versions of NSIS are development versions which *will* contain bugs, that's exactly why they are not proper release versions. Instead of jumping up and down when you spot a bug why don't you join the team of people who try to make NSIS better so that a proper release can be more quickly achieved?

Originally posted by Sunjammer
You always seem to enjoy pointing them out, I can't help but wonder why?
My former nickname was: Debugger.
Also originally posted by Sunjammer
The CVS and other recent versions of NSIS are development versions which *will* contain bugs, that's exactly why they are not proper release versions.
I know.
Also originally posted by Sunjammer
Instead of jumping up and down when you spot a bug
I don't!:mad: (at least, I think I don't ;))

Also originally posted by Sunjammer
why don't you join the team of people who try to make NSIS better so that a proper release can be more quickly achieved?
I can't. I don't know C or C++.:cry:
But I could be a good beta-tester. (At least, I think so ;))

OK... After our nice speculations about bugs, lets move on to actually work this out...

Benoni, the script you have provided can't possibly work on NSIS 1.9. I think you are talking about MakeNSISw 1.9. Open up MakeNSISw again and look at the bottom left corner of the screen. Are you using NSIS 2.0b0 or the latest CVS version (2.0b1)?


Oops
I guess I should upgrade:winamp:? :( :confused: :down: :igor:
Is there a newsletter which informs about new versions? I have been a bad boy:(


I don't know yet. First tell me what version you are using. The version you provided earlier was of MakeNSISw. It is another program that comes with NSIS, but it's not the compiler itself. The scripts you've tried won't even compile on NSIS 1.9. Open MakeNSISw.exe again and look in the bottom left corner. What does it say? What version are you using?

To keep updated about releases sign up to SourceForge, go to the project page and click the little envlope icon in the NSIS 2 Pre-release line (or click here). It will send you an e-mail whenever a pre-release version is released. To be updated as possible use the CVS version (see the FAQ for that).

I have looked at it again and it seems the problem is with your Windows version. I don't know a lot about 95 versions so I can't tell anything from the version number you gave us, so I'll have to ask you. Are you using a Windows 95 version that came before OSR2? MSDN says GetDiskFreeSpaceEx (which is used in System.nsi) only works on Windows 95 OSR2 and above.

This shouldn't matter to you much because you don't need the free space count anyway so you can just remove this line and all the calculations that come after it.


2.0b0
I thought I had put that!


Nope, you put 1.9... Never mind :)

You also said earlier that:
System::Call '${sysGetDiskFreeSpaceEx}(i r1, .r3, .r4, .r5)'

Worked for you, so you must be using post OSR2. I don't know a lot about System.dll. I will message the creator (brainsucker) and see if he can help you.


Hello. Take this example from system.nsi without some parts and with some additional comments. Hope it will help you.

p.s. works fine for me at win98 & winxp. no memory leaks or other problems found :)

; just an output string
StrCpy $7 ''

; Memory for paths
System::Alloc 1024
Pop $1
; Get drives
System::Call '${sysGetLogicalDriveStrings}(1024, r1)'
enumok:
; One more drive?
System::Call '${syslstrlen}(i r1) .r2'
IntCmp $2 0 enumex

; You can remove or change this part according to the types of drives you need to enumerate
; Is it DRIVE_FIXED?
System::Call '${sysGetDriveType} (i r1) .r3'
IntCmp $3 ${DRIVE_FIXED} 0 enumnext

; Get pretty drive path string
System::Call '*$1(&t1024 .r6)'

; At this moment $6 contains the drive root path.
StrCpy $7 "$7 $6$\n" ; Just an example of how to use it

enumnext:
; Next drive path
IntOp $1 $1 + $2
IntOp $1 $1 + 1
goto enumok
enumex: ; End of drives or user cancel
; Free memory used for paths
System::Free $1

; Something to do
MessageBox MB_OK "Cool: $\n$7"


Section ""

; just an output string
StrCpy $7 ''

; Memory for paths
System::Alloc 1024
Pop $1
; Get drives
#System::Call '${sysGetLogicalDriveStrings}(1024, r1)'
enumok:
; One more drive?
#System::Call '${syslstrlen}(i r1) .r2'
IntCmp $2 0 enumex

; You can remove or change this part according to the types of drives you need to enumerate
; Is it DRIVE_FIXED?
System::Call '${sysGetDriveType} (i r1) .r3'
IntCmp $3 ${DRIVE_FIXED} 0 enumnext

; Get pretty drive path string
System::Call '*$1(&t1024 .r6)'

; At this moment $6 contains the drive root path.
StrCpy $7 "$7 $6$\n" ; Just an example of how to use it

enumnext:
; Next drive path
IntOp $1 $1 + $2
IntOp $1 $1 + 1
goto enumok
enumex: ; End of drives or user cancel
; Free memory used for paths
System::Free $1

; Something to do
MessageBox MB_OK "Cool: $\n$7"
SectionEnd



It worked ok, except when I included one or both of the lines with the # before them. Then I would get the same 'This program has performed an illegal opperation and will be shut down.' error message