Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Detecting System Parameter

Posted on 1997-08-20
4
Medium Priority
?
343 Views
Last Modified: 2008-03-17
Is there a way in C++ or VB to detect a substitute logical drive as well as create a substitute drive.
Also, setting and retreiving environment variables.
0
Comment
Question by:rian
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 4

Expert Comment

by:md041797
ID: 1167827
What's the OS?  There is no standard way in C++.  It depends on using the OS API.
0
 

Author Comment

by:rian
ID: 1167828
The Operating System will be Windows NT Server 4.0
0
 
LVL 4

Accepted Solution

by:
md041797 earned 200 total points
ID: 1167829
use this to get all drives:

DWORD GetLogicalDriveStrings(

    DWORD nBufferLength,      // size of buffer
    LPTSTR lpBuffer       // address of buffer for drive strings
   );

The GetDriveType function determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network drive.

UINT GetDriveType(

    LPCTSTR lpRootPathName       // address of root path
   );


The GetVolumeInformation function returns information about a file system and volume whose root directory is specified. This will show you if two drive letters map to the same volume.

BOOL GetVolumeInformation(

    LPCTSTR lpRootPathName,      // address of root directory of the file system
    LPTSTR lpVolumeNameBuffer,      // address of name of the volume
    DWORD nVolumeNameSize,      // length of lpVolumeNameBuffer
    LPDWORD lpVolumeSerialNumber,      // address of volume serial number
    LPDWORD lpMaximumComponentLength,      // address of system's maximum filename length
    LPDWORD lpFileSystemFlags,      // address of file system flags
    LPTSTR lpFileSystemNameBuffer,      // address of name of file system
    DWORD nFileSystemNameSize       // length of lpFileSystemNameBuffer
   );

This is probably what you're after though:
The QueryDosDevice function lets an application obtain information about MS-DOS device names. The function can obtain the current mapping for a particular MS-DOS device name. The function can also obtain a list of all existing MS-DOS device names.

MS-DOS device names are stored as symbolic links in the Windows NT object name space. The code that converts an MS-DOS path into a corresponding Windows NT path uses these symbolic links to map MS-DOS devices and drive letters. The QueryDosDevice function provides a mechanism whereby a Win32-based application can query the names of the symbolic links used to implement the MS-DOS device namespace as well as the value of each specific symbolic link.

DWORD QueryDosDevice(

    LPCTSTR lpDeviceName,      // address of MS-DOS device name string
    LPTSTR lpTargetPath,      // address of buffer for storing query results  
    DWORD ucchMax       // maximum storage capacity of buffer  
   );      
 

The DefineDosDevice function lets an application define, redefine, or delete MS-DOS device names.

MS-DOS device names are stored as symbolic links in the object name space in 32-bit versions of Windows. The code that converts an MS-DOS path into a corresponding path in 32-bit versions of Windows uses these symbolic links to map MS-DOS devices and drive letters. The DefineDosDevice function provides a mechanism whereby a Win32-based application can modify the symbolic links used to implement the MS-DOS device name space.

BOOL DefineDosDevice(

    DWORD dwFlags,      // flags specifying aspects of device definition  
    LPCTSTR lpDeviceName,      // pointer to MS-DOS device name string  
    LPCTSTR lpTargetPath      // pointer to MS-DOS or path string for 32-bit Windows  
   );      
 

0
 

Author Comment

by:rian
ID: 1167830
Thanks md
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question