Ignore:
Timestamp:
May 10, 2002, 4:55:13 PM (23 years ago)
Author:
sandervl
Message:

hard disk access updates & fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/disk.cpp

    r8397 r8401  
    1 /* $Id: disk.cpp,v 1.35 2002-05-09 13:55:33 sandervl Exp $ */
     1/* $Id: disk.cpp,v 1.36 2002-05-10 14:55:10 sandervl Exp $ */
    22
    33/*
     
    2424#include "oslibdos.h"
    2525#include "osliblvm.h"
    26 #include "exceptutil.h"
     26#include "asmutil.h"
    2727#include "profile.h"
    2828#include "hmdisk.h"
     
    240240            pszVolume = (char *)alloca(length);
    241241
    242             strcpy(pszVolume, &lpszDrive[sizeof(VOLUME_NAME_PREFIX)-1+1]);  //-zero term + starting '{'
    243             length -= sizeof(VOLUME_NAME_PREFIX)-1+1;
    244             if(pszVolume[length-2] == '}') {
    245                 pszVolume[length-2] = 0;
     242            if(OSLibLVMStripVolumeName(lpszDrive, pszVolume, length))
     243            {
    246244                rc = OSLibLVMGetDriveType(pszVolume);
    247245                dprintf(("KERNEL32:  GetDriveType %s = %d (LVM)", lpszDrive, rc));
     
    314312            pszVolume = (char *)alloca(length);
    315313
    316             strcpy(pszVolume, &lpRootPathName[sizeof(VOLUME_NAME_PREFIX)-1]);
    317             length -= sizeof(VOLUME_NAME_PREFIX)-1;
    318             if(pszVolume[length-1] == '}') {
     314            if(OSLibLVMStripVolumeName(lpRootPathName, pszVolume, length))
     315            {
     316                pszVolume[length-2] = 0;
    319317                fVolumeName = TRUE;
    320318                goto proceed;
     
    361359            else
    362360            if(!strcmp(lpFileSystemNameBuffer, "CDFS") ||
    363                !strcmp(lpFileSystemNameBuffer, "UDF"))
     361               !strcmp(lpFileSystemNameBuffer, "UDF") ||
     362               !strcmp(lpFileSystemNameBuffer, "NTFS") ||
     363               !strcmp(lpFileSystemNameBuffer, "FAT32"))
    364364            {
    365365                //do nothing
     
    738738                                                DWORD cchBufferLength)
    739739{
    740     if(!VERSION_IS_WIN2000_OR_HIGHER()) {
    741         SetLastError(ERROR_NOT_SUPPORTED);
    742         return FALSE;
    743     }
    744 
    745     dprintf(("GetVolumeNameForVolumeMountPointA: %s", lpszVolumeMountPoint));
    746     if(OSLibLVMGetVolumeNameForVolumeMountPoint(lpszVolumeMountPoint, lpszVolumeName,
     740    LPSTR pszvol;
     741
     742    pszvol = (char *)alloca(cchBufferLength);
     743    if(pszvol == NULL) {
     744        DebugInt3();
     745        return FALSE;
     746    }
     747
     748    if(!VERSION_IS_WIN2000_OR_HIGHER()) {
     749        SetLastError(ERROR_NOT_SUPPORTED);
     750        return FALSE;
     751    }
     752
     753    if(OSLibLVMGetVolumeNameForVolumeMountPoint(lpszVolumeMountPoint, pszvol,
    747754                                                cchBufferLength) == TRUE)
    748755    {
     756        int length = strlen(pszvol);
     757        if(length + sizeof(VOLUME_NAME_PREFIX) - 1 + 3 > cchBufferLength) {
     758            SetLastError(ERROR_INSUFFICIENT_BUFFER);
     759            return FALSE;
     760        }
     761        sprintf(lpszVolumeName, VOLUME_NAME_PREFIX"{%s}\\", pszvol);
     762
     763        dprintf(("GetVolumeNameForVolumeMountPointA %s returned %s", lpszVolumeMountPoint, lpszVolumeName));
    749764        SetLastError(ERROR_SUCCESS);
    750765        return TRUE;
    751766    }
     767    dprintf(("GetVolumeNameForVolumeMountPointA: %s not found!!", lpszVolumeMountPoint));
    752768    SetLastError(ERROR_FILE_NOT_FOUND);
    753769    return FALSE;
Note: See TracChangeset for help on using the changeset viewer.