|
|
1.1 root 1: /*
2: Hatari
3:
4: Create Disc Image functions
5: */
6:
1.1.1.2 ! root 7:
! 8: /* FIXME: This file needs a nearly complete rewrite to be used in Hatari */
! 9:
1.1 root 10: #include <stdio.h>
11:
12: #include "main.h"
13: #include "debug.h"
14:
1.1.1.2 ! root 15:
1.1 root 16: /*-----------------------------------------------------------------------*/
17: /*
18: Lock disc volume
19: */
1.1.1.2 ! root 20: /*
1.1 root 21: BOOL CreateDiscImage_LockVolume(FILE *hDisk)
22: {
1.1.1.2 ! root 23: DWORD ReturnedByteCount;
1.1 root 24:
1.1.1.2 ! root 25: return(DeviceIoControl(hDisk,FSCTL_LOCK_VOLUME,NULL,0,NULL,0,&ReturnedByteCount,NULL));
1.1 root 26: }
1.1.1.2 ! root 27: */
! 28:
1.1 root 29:
30: /*-----------------------------------------------------------------------*/
31: /*
32: UnLock disc volume
33: */
1.1.1.2 ! root 34: /*
1.1 root 35: BOOL CreateDiscImage_UnLockVolume(FILE *hDisk)
36: {
1.1.1.2 ! root 37: DWORD ReturnedByteCount;
1.1 root 38:
1.1.1.2 ! root 39: return(DeviceIoControl(hDisk,FSCTL_UNLOCK_VOLUME,NULL,0,NULL,0,&ReturnedByteCount,NULL));
1.1 root 40: }
1.1.1.2 ! root 41: */
! 42:
1.1 root 43:
44: /*-----------------------------------------------------------------------*/
45: /*
46: Read PC floppy disc into image file
47: */
48: void CreateDiscImage_ReadImage(char *pszDriveName)
49: {
1.1.1.2 ! root 50: #if 0
1.1 root 51: char szDrive[MAX_FILENAME_LENGTH];
52: FILE *hDrive;
53:
54: /* Build PC floppy image name */
55: sprintf(szDrive,"%s",pszDriveName);
56: hDrive = fopen(szDrive, "rwb");
57: if (hDrive!=NULL)
58: {
59: if (CreateDiscImage_LockVolume(hDrive))
60: {
61: #ifdef DEBUG_TO_FILE
62: Debug_File("all ok\n");
63: #endif
64: CreateDiscImage_UnLockVolume(hDrive);
65: }
66: else
67: {
68: #ifdef DEBUG_TO_FILE
69: Debug_File("MFMT:Locking volume %s %s failed %d\n", szDrive,pszDriveName, GetLastError());
70: #endif
71: }
72: }
73: else
74: {
75: #ifdef DEBUG_TO_FILE
76: Debug_File("MFMT: Open %s %s failed %d\n", szDrive,pszDriveName, GetLastError());
77: #endif
78: }
1.1.1.2 ! root 79: #endif
1.1 root 80: }
81:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.