GUI ScreenIO for Windows

 ScreenIO.com


DriveToUNC

This API will convert a Driver Letter based file or directory name to the Universal Naming Convention name of the file or directory.

Assume the input to this API is file specification in the form Drive:\directory\...\file.extension  such as H:\data\cust.db  
Further assume Drive H is mapped to a share named "production" on a server named Sales.

In this case calling the DriveToUNC with H:\data\cust.db  would return \\Sales\production\data\cust.db as the UNC name.

If all you want to know is whether or not a drive is mapped simply call this API with the drive letter, Colon, and Backslash.  "Y:\".

Calling DriveToUNC with a local drive letter such as C:\ wield yield an error code DTU-NOT-A-MAPPED-DRIVE (2250).  

In this way you can tell if a file is on a local hard disk or remote share.

This API does not work on Windows 95, and will always return DTU-INVALID-Drive.

Client/Server issues

The API may be used to obtain information about a drive on either the client or the server.  To interrogate drives on the server:

     SET WIN32API-EXECUTE-API-ON-SERVER TO TRUE

Files

Files available to copy to your system:

Usage

     COPY WIN32API.
     COPY DRIVEUNC.

* ------------------------: Call the API.

     SET API-DRIVETOUNC TO TRUE.

     MOVE 'F:\MYFILE.COB' TO DTU-DRIVE-LETTER-PATH
     
     CALL 'GSWINAPI' USING WIN32API-PARMS
                           DTU-DRIVE-LETTER-PATH
                           DTU-UNIVERSAL-NAME
                           DTU-CONNECTION-NAME
                           DTU-REMAINING-PATH
                           DTU-ERROR-CODE
                           WIN32API-F.
                        

Parameters specific to this function

DTU-DRIVE-LETTER-PATH

This is the Drive Letter based specification for a Drive, or a Directory, or a File.  It must be in valid format, but the actual file or directory need not actually exist.  (You can get a UNC name for a file that you might plan to create later for instance).

DTU-UNIVERSAL-NAME

Upon return from the call, this will contain the Universal Naming Convention for the location you specified.

DTU-CONNECTION-NAME

This will contain the Server name and Share name portion of the UNC. 

DTU-REMAINING-PATH

This field will contain the remaining part (beyond the Server and Share) of the path to the file or directory.  If you specify only a drive letter, this portion will be empty.

DTU-ERROR-CODE

If the call to this API is not successful (win32api-rc = zero) this field will be set to one of the values listed in the copybook.  These error codes have 88 names that are reasonably descriptive.  Of special Interest are the following:

DTU-NOT-A-MAPPED-DRIVE  (2250):  This means the Drive-letter-path is a local disk, and not mapped to a server share.

DTU-INVALID-DRIVE (1200):  This means you specified a drive letter that does not exist, or you are running on Windows 95.

DTU-INTERNAL-ERROR (234):  Notify Norcom.  Internal buffer space is not sufficient.  As a short term work around consider  adding a share name on the server to the specific directory you need. 

WIN32API-PARMS - Used in all GSWINAPI calls

This argument is standard for all CALLs to GSWINAPI. It is used to select the desired API or function, and to return the status of the operation.

WIN32API-RC

Used to return the status of a call to GSWINAPI.  A value of zero is a failure, any other value indicates success.

Recommended usage is to test the 88-level value WIN32API to see if it worked, then to use the text error message to see why it failed.

* ------------------------: If function failed,
*                         :   display the error in a message box.
*
     IF WIN32API-FAILED
       MOVE WIN32API-ERROR-TEXT TO panel-MESSAGE-TEXT
       SET panel-MESSAGE-IN-MESSAGEBOX TO TRUE.

WIN32API-ERROR-CODE

Error code that was returned by Windows.  This is not generally useful unless you have the Windows Platform SDK documentation available to you.

WIN32API-ERROR-TEXT

Plain-text error message that describes why the operation failed.

WIN32API-A through WIN32API-F

The number of these present varies depending on how many arguments are used by the desired function.  These are not used, but must be present because this CALL requires seven arguments.


© 2000-2019 Norcom, all rights reserved 

TOC

Send feedback to Norcom