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
ea5941ba
Commit
ea5941ba
authored
25 years ago
by
Peter Ganten
Committed by
Alexandre Julliard
25 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix GetCurrentDirectoryA and W to return the needed space for the CWD,
if the buffer size is not large enough.
parent
f92a7770
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
files/drive.c
+13
-8
13 additions, 8 deletions
files/drive.c
with
13 additions
and
8 deletions
files/drive.c
+
13
−
8
View file @
ea5941ba
...
@@ -286,7 +286,7 @@ int DRIVE_SetCurrentDrive( int drive )
...
@@ -286,7 +286,7 @@ int DRIVE_SetCurrentDrive( int drive )
/***********************************************************************
/***********************************************************************
* DRIVE_FindDriveRoot
* DRIVE_FindDriveRoot
*
*
* Find a drive for which the root matches the beg
g
inning of the given path.
* Find a drive for which the root matches the beginning of the given path.
* This can be used to translate a Unix path into a drive + DOS path.
* This can be used to translate a Unix path into a drive + DOS path.
* Return value is the drive, or -1 on error. On success, path is modified
* Return value is the drive, or -1 on error. On success, path is modified
* to point to the beginning of the DOS path.
* to point to the beginning of the DOS path.
...
@@ -686,7 +686,7 @@ static int DRIVE_GetFreeSpace( int drive, PULARGE_INTEGER size,
...
@@ -686,7 +686,7 @@ static int DRIVE_GetFreeSpace( int drive, PULARGE_INTEGER size,
return
1
;
return
1
;
}
}
/*
/*
**********************************************************************
* DRIVE_GetCurrentDirectory
* DRIVE_GetCurrentDirectory
* Returns "X:\\path\\etc\\".
* Returns "X:\\path\\etc\\".
*
*
...
@@ -1033,12 +1033,17 @@ UINT WINAPI GetCurrentDirectoryA( UINT buflen, LPSTR buf )
...
@@ -1033,12 +1033,17 @@ UINT WINAPI GetCurrentDirectoryA( UINT buflen, LPSTR buf )
{
{
UINT
ret
;
UINT
ret
;
char
longname
[
MAX_PATHNAME_LEN
];
char
longname
[
MAX_PATHNAME_LEN
];
char
shortname
[
MAX_PATHNAME_LEN
];
ret
=
DRIVE_GetCurrentDirectory
(
buflen
,
buf
);
ret
=
DRIVE_GetCurrentDirectory
(
MAX_PATHNAME_LEN
,
shortname
);
GetLongPathNameA
(
buf
,
longname
,
buflen
);
if
(
ret
>
MAX_PATHNAME_LEN
)
{
ERR_
(
file
)(
"pathnamelength (%d) > MAX_PATHNAME_LEN!
\n
"
,
ret
);
return
ret
;
}
GetLongPathNameA
(
shortname
,
longname
,
MAX_PATHNAME_LEN
);
ret
=
lstrlenA
(
longname
)
+
1
;
if
(
ret
>
buflen
)
return
ret
;
lstrcpyA
(
buf
,
longname
);
lstrcpyA
(
buf
,
longname
);
return
ret
-
1
;
return
ret
;
}
}
/***********************************************************************
/***********************************************************************
...
@@ -1048,7 +1053,7 @@ UINT WINAPI GetCurrentDirectoryW( UINT buflen, LPWSTR buf )
...
@@ -1048,7 +1053,7 @@ UINT WINAPI GetCurrentDirectoryW( UINT buflen, LPWSTR buf )
{
{
LPSTR
xpath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
buflen
+
1
);
LPSTR
xpath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
buflen
+
1
);
UINT
ret
=
GetCurrentDirectoryA
(
buflen
,
xpath
);
UINT
ret
=
GetCurrentDirectoryA
(
buflen
,
xpath
);
lstrcpyAtoW
(
buf
,
xpath
);
if
(
ret
<
buflen
)
lstrcpyAtoW
(
buf
,
xpath
);
HeapFree
(
GetProcessHeap
(),
0
,
xpath
);
HeapFree
(
GetProcessHeap
(),
0
,
xpath
);
return
ret
;
return
ret
;
}
}
...
...
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