Go Back   FileForums > Game Backup > PC Games > PC Games - CD/DVD Conversions > Conversion Tutorials

Reply
 
Thread Tools Display Modes
  #1  
Old 25-04-2020, 07:33
sakila(playboy) sakila(playboy) is offline
Registered User
 
Join Date: Jun 2019
Location: Srilanka
Posts: 15
Thanks: 16
Thanked 8 Times in 6 Posts
sakila(playboy) is on a distinguished road
Inno setup - NoSD Code (plz help me)

Can anyone tell me what's wrong this?


const
DRIVE_UNKNOWN = 0;
DRIVE_NO_ROOT_DIR = 1;
DRIVE_REMOVABLE = 2;
DRIVE_FIXED = 3;
DRIVE_REMOTE = 4;
DRIVE_CDROM = 5;
DRIVE_RAMDISK = 6;
SHCNE_ASSOCCHANGED = $08000000;
SHCNF_IDLIST = $00000000;

function GetLogicalDrives: DWord;
external '[email protected] stdcall';
function GetDriveTypeA(lpRootPathName: AnsiString): UInt;
external '[email protected] stdcall';

function NoSD(s: String): String;
var
x, bit, i: Integer;
tp: Cardinal;
sd: string;
Begin
sd := ExpandConstant('{sd}');
x := GetLogicalDrives;
if x <> 0 then begin
for i:= 1 to 64 do begin
bit := x and 1;
if bit = 1 then begin
tp := GetDriveTypeA(PAnsiChar(Chr(64 + i) + ':'));
if tp = DRIVE_FIXED then begin
if Chr(64 + i) <> Copy(sd, 1, 1) then begin
Result := Chr(64 + i) + ':';
Break;
end;
end;
end;
x := x shr 1;
end;
end;
end;
Reply With Quote
The Following User Says Thank You to sakila(playboy) For This Useful Post:
GaMEr_2077 (31-05-2021)
Sponsored Links
  #2  
Old 25-04-2020, 09:08
Cesar82's Avatar
Cesar82 Cesar82 is offline
Registered User
 
Join Date: May 2011
Location: Brazil
Posts: 707
Thanks: 988
Thanked 1,276 Times in 459 Posts
Cesar82 is on a distinguished road
The code is working correctly.
It returns the first drive unit found that is fixed (HD/SSD) and is not the system drive.
Reply With Quote
The Following User Says Thank You to Cesar82 For This Useful Post:
sakila(playboy) (27-04-2020)
  #3  
Old 27-04-2020, 09:59
sakila(playboy) sakila(playboy) is offline
Registered User
 
Join Date: Jun 2019
Location: Srilanka
Posts: 15
Thanks: 16
Thanked 8 Times in 6 Posts
sakila(playboy) is on a distinguished road
Ok how to fix that
Reply With Quote
  #4  
Old 25-05-2020, 17:15
Emorian Emorian is offline
Registered User
 
Join Date: Oct 2011
Location: Hungary
Posts: 26
Thanks: 14
Thanked 4 Times in 4 Posts
Emorian is on a distinguished road
Quote:
Originally Posted by sakila(playboy) View Post
Can anyone tell me what's wrong this?

Work:
Red = you add
Green = delete
Code:
  var
   x, bit, i: Integer;
   tp: Cardinal;
   sd: string;
  Begin
   sd := ExpandConstant('{sd}');
   Result := ExpandConstant('{pf}\');
   x := GetLogicalDrives;
   If x <> 0 Then
    For i:= 1 To 64 Do
     Begin
      bit := x and 1;
      If bit = 1 Then
       Begin
        tp := GetDriveType(PAnsiChar(Chr(64 + i) + ':'));
        If tp = DRIVE_FIXED Then
         If Chr(64 + i) <> Copy(sd, 1, 1) Then
          Begin
           Result := Chr(64 + i) + ':\Games\';
           Break;
          End;
       End;
      x := x shr 1;
     End;
  End;
End;

Last edited by Emorian; 25-05-2020 at 17:19.
Reply With Quote
The Following User Says Thank You to Emorian For This Useful Post:
sakila(playboy) (04-06-2020)
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[CIUv3] Custom Installer Ultimate v3 KaktoR Conversion Tutorials 831 19-06-2021 03:44
BlackBox v2 y_thelastknight Conversion Tutorials 558 01-06-2021 03:29
INNO TROUBLESHOOT - Tutorials and Answers about INNO Setup REV0 Conversion Tutorials 129 21-05-2021 05:51
Useful Dll for Inno Setup users peterf1999 Conversion Tutorials 88 01-12-2017 16:00
INNO TUTORIAL - Using Unicode and ANSI Versions of INNO Setup REV0 Conversion Tutorials 51 26-03-2015 06:57



All times are GMT -7. The time now is 01:50.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Copyright 2000-2020, FileForums @ https://fileforums.com