Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jason Beetham
wine
Commits
cd9a633f
Commit
cd9a633f
authored
25 years ago
by
Petr Tomasek
Committed by
Alexandre Julliard
25 years ago
Browse files
Options
Downloads
Patches
Plain Diff
- Write serial numbers to the device (FAT)
- DRIVE_ReadSuperblock: better checking for the FAT fs.
parent
59b5f786
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
files/drive.c
+63
-7
63 additions, 7 deletions
files/drive.c
with
63 additions
and
7 deletions
files/drive.c
+
63
−
7
View file @
cd9a633f
...
...
@@ -423,7 +423,9 @@ const char * DRIVE_GetDevice( int drive )
/***********************************************************************
* DRIVE_ReadSuperblock
*
* Used in DRIVE_GetLabel
* NOTE
* DRIVE_SetLabel and DRIVE_SetSerialNumber use this in order
* to check, that they are writing on a FAT filesystem !
*/
int
DRIVE_ReadSuperblock
(
int
drive
,
char
*
buff
)
{
...
...
@@ -469,9 +471,16 @@ int DRIVE_ReadSuperblock (int drive, char * buff)
{
case
TYPE_FLOPPY
:
case
TYPE_HD
:
if
(
buff
[
0x26
]
!=
0x29
)
/* Check for FAT present */
return
-
3
;
break
;
if
((
buff
[
0x26
]
!=
0x29
)
||
/* Check for FAT present */
/* FIXME: do really all Fat have their name beginning with
"FAT" ? (At least FAT12, FAT16 and FAT32 have :) */
memcmp
(
buff
+
0x36
,
"FAT"
,
3
))
{
ERR
(
"The filesystem is not FAT !! (device=%s)
\n
"
,
DOSDrives
[
drive
].
device
);
return
-
3
;
}
break
;
case
TYPE_CDROM
:
if
(
strncmp
(
&
buff
[
1
],
"CD001"
,
5
))
/* Check for iso9660 present */
return
-
3
;
...
...
@@ -486,6 +495,42 @@ int DRIVE_ReadSuperblock (int drive, char * buff)
}
/***********************************************************************
* DRIVE_WriteSuperblockEntry
*
* NOTE
* We are writing as little as possible (ie. not the whole SuperBlock)
* not to interfere with kernel. The drive can be mounted !
*/
int
DRIVE_WriteSuperblockEntry
(
int
drive
,
off_t
ofs
,
size_t
len
,
char
*
buff
)
{
int
fd
;
if
((
fd
=
open
(
DOSDrives
[
drive
].
device
,
O_WRONLY
))
==-
1
)
{
ERR
(
"Cannot open the device %s (for writing)
\n
"
,
DOSDrives
[
drive
].
device
);
return
-
1
;
}
if
(
lseek
(
fd
,
ofs
,
SEEK_SET
)
!=
ofs
)
{
ERR
(
"lseek failed on device %s !
\n
"
,
DOSDrives
[
drive
].
device
);
close
(
fd
);
return
-
2
;
}
if
(
write
(
fd
,
buff
,
len
)
!=
len
)
{
close
(
fd
);
ERR
(
"Cannot write on %s !
\n
"
,
DOSDrives
[
drive
].
device
);
return
-
3
;
}
return
close
(
fd
);
}
/***********************************************************************
* DRIVE_GetLabel
*/
...
...
@@ -584,10 +629,21 @@ char buff[DRIVE_SUPER];
*/
int
DRIVE_SetSerialNumber
(
int
drive
,
DWORD
serial
)
{
char
buff
[
DRIVE_SUPER
];
if
(
!
DRIVE_IsValid
(
drive
))
return
0
;
if
((
DOSDrives
[
drive
].
read_volinfo
)
&&
(
DOSDrives
[
drive
].
type
!=
TYPE_CDROM
))
FIXME
(
"Setting the serial number is useless for drive %c: until writing it is properly implemented, as this drive reads it from the device.
\n
"
,
'A'
+
drive
);
if
(
DOSDrives
[
drive
].
read_volinfo
)
{
if
((
DOSDrives
[
drive
].
type
!=
TYPE_FLOPPY
)
&&
(
DOSDrives
[
drive
].
type
!=
TYPE_HD
))
return
0
;
/* check, if the drive has a FAT filesystem */
if
(
DRIVE_ReadSuperblock
(
drive
,
buff
))
return
0
;
if
(
DRIVE_WriteSuperblockEntry
(
drive
,
0x27
,
4
,
(
char
*
)
&
serial
))
return
0
;
return
1
;
}
if
(
DOSDrives
[
drive
].
type
==
TYPE_CDROM
)
return
0
;
DOSDrives
[
drive
].
serial_conf
=
serial
;
return
1
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment