Annotation of hatari/src/createDiscImage.c, revision 1.1

1.1     ! root        1: /*
        !             2:   Hatari
        !             3: 
        !             4:   Create Disc Image functions
        !             5: */
        !             6: 
        !             7: #include <stdio.h>
        !             8: 
        !             9: #include "main.h"
        !            10: #include "debug.h"
        !            11: 
        !            12: /*-----------------------------------------------------------------------*/
        !            13: /*
        !            14:   Lock disc volume
        !            15: */
        !            16: BOOL CreateDiscImage_LockVolume(FILE *hDisk)
        !            17: {
        !            18: //  DWORD ReturnedByteCount;
        !            19: 
        !            20: //  return(DeviceIoControl(hDisk,FSCTL_LOCK_VOLUME,NULL,0,NULL,0,&ReturnedByteCount,NULL));
        !            21: }
        !            22: 
        !            23: /*-----------------------------------------------------------------------*/
        !            24: /*
        !            25:   UnLock disc volume
        !            26: */
        !            27: BOOL CreateDiscImage_UnLockVolume(FILE *hDisk)
        !            28: {
        !            29: //  DWORD ReturnedByteCount;
        !            30: 
        !            31: //  return(DeviceIoControl(hDisk,FSCTL_UNLOCK_VOLUME,NULL,0,NULL,0,&ReturnedByteCount,NULL));
        !            32: }
        !            33: 
        !            34: /*-----------------------------------------------------------------------*/
        !            35: /*
        !            36:   Read PC floppy disc into image file
        !            37: */
        !            38: void CreateDiscImage_ReadImage(char *pszDriveName)
        !            39: {
        !            40:  char szDrive[MAX_FILENAME_LENGTH];
        !            41:  FILE *hDrive;
        !            42: 
        !            43:  /* Build PC floppy image name */
        !            44:  sprintf(szDrive,"%s",pszDriveName);
        !            45:  hDrive = fopen(szDrive, "rwb");
        !            46:  if (hDrive!=NULL)
        !            47:    {
        !            48:     if (CreateDiscImage_LockVolume(hDrive))
        !            49:       {
        !            50: #ifdef DEBUG_TO_FILE
        !            51:        Debug_File("all ok\n");
        !            52: #endif
        !            53:        CreateDiscImage_UnLockVolume(hDrive);
        !            54:       }
        !            55:      else
        !            56:       {
        !            57: #ifdef DEBUG_TO_FILE
        !            58:        Debug_File("MFMT:Locking volume %s %s failed %d\n", szDrive,pszDriveName, GetLastError());
        !            59: #endif
        !            60:       }
        !            61:    }
        !            62:   else
        !            63:    {
        !            64: #ifdef DEBUG_TO_FILE
        !            65:     Debug_File("MFMT: Open %s %s failed %d\n", szDrive,pszDriveName, GetLastError());
        !            66: #endif
        !            67:    }
        !            68: }
        !            69: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.