473,748 Members | 7,142 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GetLogicalDrive s doesn't retrieve remote drives on Windows Vista

Hi,
I have a big problem with a Visual C++ 6.0 function that retrives the
logical drives and types in the local system.
This function works perfectly on Windows 98, NT, 2000, XP and 2003, but I
have tested it on Windows Vista and it doesn't retrieve remote network
drives. It must retrieve a string with the drive letters and a string with
the drive types (2=removable drive, 3=hard drive, 4=remote drive, 5=CD-ROM
drive, 6=RAM drive)
I always run this function using a Windows user in the Administrators group,
but it still fails in Windows Vista.
Do you know how to configure Windows Vista in order to get the local network
drives?
This is my code with debug message boxes:
void GetLocalDrives( CString &strDrives, CString &strTypes)
{
DWORD unitmask;
char units[27];
char types[27];
int i, n;
char unit[4];
UINT unittype;
char szMsg[80];

unitmask = GetLogicalDrive s();
n = 0;
for (i = 0; i < 26; i++)
{
if (unitmask & 0x1)
{
sprintf(unit, "%c:\\", 'A' + i);
units[n] = *unit;
unittype = GetDriveType(un it);
types[n++] = '0' + unittype;
switch (unittype)
{
case DRIVE_UNKNOWN:
sprintf(szMsg, "Drive %s of unknown type", unit);
break;
case DRIVE_NO_ROOT_D IR:
sprintf(szMsg, "Drive %s is invalid", unit);
break;
case DRIVE_REMOVABLE :
sprintf(szMsg, "Drive %s is a removable drive", unit);
break;
case DRIVE_FIXED:
sprintf(szMsg, "Drive %s is a hard disk", unit);
break;
case DRIVE_REMOTE:
sprintf(szMsg, "Drive %s is a network drive", unit);
break;
case DRIVE_CDROM:
sprintf(szMsg, "Drive %s is a CD-ROM drive", unit);
break;
case DRIVE_RAMDISK:
sprintf(szMsg, "Drive %s is a RAM disk", unit);
break;
default:
sprintf(szMsg, "Drive %s has an unknown %u drive type", unit,
unittype);
}
AfxMessageBox(s zMsg);
}
unitmask = unitmask >1;
}
units[n] = '\0';
types[n] = '\0';
sprintf(szMsg, "Local drives:\t%s\nTy pes:\t%s\n", units, types);
AfxMessageBox(s zMsg);
strDrives = units;
strTypes = types;
}

Thanks,
Luis Antonio Rosello Garcia
Pulso Informatica, S.L.
mailto:la*@puls oinformatica.es

Apr 24 '07 #1
9 8556
I have a big problem with a Visual C++ 6.0 function that retrives the
logical drives and types in the local system.
This function works perfectly on Windows 98, NT, 2000, XP and 2003, but I
have tested it on Windows Vista and it doesn't retrieve remote network
drives.
Hi,
Try asking in the appropriate platform sdk groups. This is a C++ newsgroup,
but your problem is a platform problem, not a C++ problem. N ot that we
don't want to help, but you have better chances of finding a correct answer
in the PSDK groups.

--
Kind regards,
Bruno van Dooren MVP - VC++
http://msmvps.com/blogs/vanDooren
br************* *********@hotma il.com
Apr 25 '07 #2
Hi Bruno,
I've just discovered that if I enable the Administrator user and run my
program using this account, then the GetLogicalDrive s runs perfectly.
I don't know why my user in the Administrators group of users can't be able
to access to remote drives, but
Do you know how to get Administrator user rights in order to run my Visual
C++ installation program without problems?
Thank's,
--
Luis Antonio Rosello Garcia
Pulso Informatica, S.L.
mailto:la*@puls oinformatica.es

"Bruno van Dooren" wrote:
I have a big problem with a Visual C++ 6.0 function that retrives the
logical drives and types in the local system.
This function works perfectly on Windows 98, NT, 2000, XP and 2003, but I
have tested it on Windows Vista and it doesn't retrieve remote network
drives.

Hi,
Try asking in the appropriate platform sdk groups. This is a C++ newsgroup,
but your problem is a platform problem, not a C++ problem. N ot that we
don't want to help, but you have better chances of finding a correct answer
in the PSDK groups.

--
Kind regards,
Bruno van Dooren MVP - VC++
http://msmvps.com/blogs/vanDooren
br************* *********@hotma il.com
Apr 25 '07 #3
>I've just discovered that if I enable the Administrator user and run my
>program using this account, then the GetLogicalDrive s runs perfectly.
I don't know why my user in the Administrators group of users can't be able
to access to remote drives
It does seem odd. Can that user see those drives with Explorer?
>Do you know how to get Administrator user rights in order to run my Visual
C++ installation program without problems?
If its an installer, it probably should be running as Administrator
already - do you not get a UAC prompt automatically when you start the
installation? What installer is it?

If you do really need admin rights, your program should have a
manifest with the following information:

<trustInfo xmlns="urn:sche mas-microsoft-com:asm.v3">
<security>
<requestedPrivi leges>
<requestedExecu tionLevel
level="requireA dministrator" uiAccess="false "/>
</requestedPrivil eges>
</security>
</trustInfo>

For more information on the subject try Googling for the terms:
requestedExecut ionLevel and requireAdminist rator.

Dave
Apr 25 '07 #4
Hi David,
I have connected the remote drives from Windows Explorer, and I can see and
I have all permissions on remote drives from Windows Explorer. Also I have
tested the NET USE command to connect them with the same results, Explorer
goes ok and GetLogicalDrive s not.
The function that uses the GetLogicalDrive s is inside a Windows MFC
application made by me using Visual C++ 6.0 and Microsoft Platform SDK
february 2003 (the last compatible with Visual Studio 6.0).
The user I use in order to execute my application is the administrator user
created during Windows Vista installation, that is included in the
administrators group. Also the Administrator user was disabled, and I had to
enable it and start session with this user in order to get the remote drives
returned by GetLogicalDrive s.
I don't know how to apply your XML file to my Visual C++ application. I
think that you supposed that my installation program was made using Windows
Installer, Installshield or anything similar.
Thank's David
Best regards,
--
Luis Antonio Rosello Garcia
Pulso Informatica, S.L.
mailto:la*@puls oinformatica.es

"David Lowndes" wrote:
I've just discovered that if I enable the Administrator user and run my
program using this account, then the GetLogicalDrive s runs perfectly.
I don't know why my user in the Administrators group of users can't be able
to access to remote drives

It does seem odd. Can that user see those drives with Explorer?
Do you know how to get Administrator user rights in order to run my Visual
C++ installation program without problems?

If its an installer, it probably should be running as Administrator
already - do you not get a UAC prompt automatically when you start the
installation? What installer is it?

If you do really need admin rights, your program should have a
manifest with the following information:

<trustInfo xmlns="urn:sche mas-microsoft-com:asm.v3">
<security>
<requestedPrivi leges>
<requestedExecu tionLevel
level="requireA dministrator" uiAccess="false "/>
</requestedPrivil eges>
</security>
</trustInfo>

For more information on the subject try Googling for the terms:
requestedExecut ionLevel and requireAdminist rator.

Dave
Apr 25 '07 #5
Luis,

I think I can reproduce what you're seeing. I've just tried your code
on Vista and these are the results I get:

If I connect a network drive in Explorer while logged on as the normal
Administrator account (with UAC enabled) and then try your code in a
test application set to run "AsInvoker" , your code sees the network
drive.

However, if I right click on the exe and choose Run As Administrator,
it doesn't report the network drive.

It's as though the elevation account doesn't inherit the drive
mapping.
>I don't know how to apply your XML file to my Visual C++ application.
Goggle for those terms I gave you.

Dave
Apr 25 '07 #6
Hi David,
I can't put the NxfCliente.exe. manifiest document in my installation
application as a resource and set it to run "AsInvoker" , because it is a
Visual C++ 6.0 MFC .EXE application and Visual C++ 6.0 has only one resorce
file and has no run settings (except debug or release, use of MFC static or
shared, and little more).
I've created the NxfCliente.exe. manifiest document in the same directory as
my NxfCliente.exe and run it in Windows Vista, but Windows Vista still
returns only local drives, so network drives aren't returned.
Thank you.
Best regards,
--
Luis Antonio Rosello Garcia
Pulso Informatica, S.L.
mailto:la*@puls oinformatica.es

"David Lowndes" wrote:
Luis,

I think I can reproduce what you're seeing. I've just tried your code
on Vista and these are the results I get:

If I connect a network drive in Explorer while logged on as the normal
Administrator account (with UAC enabled) and then try your code in a
test application set to run "AsInvoker" , your code sees the network
drive.

However, if I right click on the exe and choose Run As Administrator,
it doesn't report the network drive.

It's as though the elevation account doesn't inherit the drive
mapping.
I don't know how to apply your XML file to my Visual C++ application.

Goggle for those terms I gave you.

Dave
May 2 '07 #7
>I can't put the NxfCliente.exe. manifiest document in my installation
>application as a resource and set it to run "AsInvoker" , because it is a
Visual C++ 6.0 MFC .EXE application and Visual C++ 6.0 has only one resorce
file and has no run settings (except debug or release, use of MFC static or
shared, and little more).
There will be a way of doing it - but I don't off-hand know what it
is.

Dave
May 2 '07 #8
>>I can't put the NxfCliente.exe. manifiest document in my installation
>>application as a resource and set it to run "AsInvoker" , because it is a
Visual C++ 6.0 MFC .EXE application and Visual C++ 6.0 has only one resorce
file and has no run settings (except debug or release, use of MFC static or
shared, and little more).

There will be a way of doing it - but I don't off-hand know what it
is.
For instance:

http://bobmoore.mvps.org/Win32/w32tip76.htm

Dave
May 2 '07 #9
Hi Dave,
I think that I will keep my install program running in Administrator user
session, because it runs ok if you start session with this user. I have now
more urgent questions because the application that my program installs uses a
lot of devices and there is no driver for Windows Vista (ticket and standard
printers, modems, visor displays, robots, scanners, card readers, etc) and
also installs Oracle 9i software and an Oracle 9i database, but Oracle 9i
Universal Installer isn't certified by Oracle and doesn't run in Windows
Vista (sometimes Oracle don't certifies a product in an operative system but
it runs, in this case it doesn't run).
Thank's a lot Dave.
Have a good day,
--
Luis Antonio Rosello Garcia
Pulso Informatica, S.L.
mailto:la*@puls oinformatica.es

"David Lowndes" wrote:
I can't put the NxfCliente.exe. manifiest document in my installation
application as a resource and set it to run "AsInvoker" , because it is a
Visual C++ 6.0 MFC .EXE application and Visual C++ 6.0 has only one resorce
file and has no run settings (except debug or release, use of MFC static or
shared, and little more).

There will be a way of doing it - but I don't off-hand know what it
is.

Dave
May 2 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
12158
by: lastusernameleft | last post by:
Is there a .NET method for doing this? I haven't found anything else that works. Thanks
3
4711
by: Dean Slindee | last post by:
Once you've gotten a list of logical drives with Directory.GetLogicalDrives, how would you get the name associated with that drive? Thanks, Dean Slindee
0
891
by: Daniel | last post by:
Hi groups, me again! Is there a way to force the FolderBrowser control to display all the physical drives (not shares) on a remote machine? For example, I have a machine called ABC that has drives C and D. Can I get the browser to show me these drives? TIA --
2
1263
by: Daniel | last post by:
Any ideas why the below function does not work? It just returns the drives of the local computer not the remote one. I don't think it is permissions because I am in the Admins group on the remote computer. Private Function GetRemoteDrives(ByVal RemoteServer As String) As String Dim moMOS As System.Management.ManagementObjectSearcher Dim moObject As System.Management.ManagementObject
23
5382
by: wylbur37 | last post by:
I'm running an Apache server on my own computer (Windows XP Pro). I wrote a simple PHP script (called test3.php) that I'm running by putting the following URL in the address bar of the browser (Firefox) .... http://localhost/test3.php The script generates the following link using the echo statement ...
0
1550
by: rmckbrown | last post by:
Using .Net FW 1.1 and VB.net I am calling system.io.directory.getlogicaldrives from a windows service; however, only the local drives are returned, and not my mapped drives. When I execute the call from a regular Windows application, all of the drives are returned. Any thoughts on why the mapped drives are not returned when the call is made from a windows service? The windows service is running under a domain user account with admin...
15
7083
by: =?Utf-8?B?TVNU?= | last post by:
To demonstrate my problem, I have a very simple VB Windows application. It has a text box that is used to display a counter, a button to reset the counter, and a timer that increments the counter every second. I remote desktop to the computer hosting this application and run the application. It starts up and displays the counter incrementing every second. If I disconnect the network cable between the two computers for 10 seconds and...
4
2568
by: Ryderch | last post by:
Greetings folks! I need to open a file located on a remote machine running DOS (ouch!) from a client running Vista. The network connection is based on NetBEUI. Test1 Code running on the Vista workstation: FILE *fp;
4
2432
by: Kerem Gümrükcü | last post by:
Hi, is it possible to get the Information that comes from OperatingSystem Class from a Remote Comupter. Is there a remote information supporting OperatingSystem Class or can i get this information another way, e.g. from opening remote registry? The target Systems are strictly Windows.
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9541
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8242
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4602
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3312
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2782
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.