Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
4291e45c
Commit
4291e45c
authored
Jan 18, 2002
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Jan 18, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix return value of GetWindowsDirectoryA/W and GetSystemDirectoryA/W.
parent
8121e941
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
10 deletions
+32
-10
directory.c
files/directory.c
+32
-10
No files found.
files/directory.c
View file @
4291e45c
...
...
@@ -261,24 +261,37 @@ UINT16 WINAPI GetWindowsDirectory16( LPSTR path, UINT16 count )
/***********************************************************************
* GetWindowsDirectoryA (KERNEL32.@)
*
* See comment for GetWindowsDirectoryW.
*/
UINT
WINAPI
GetWindowsDirectoryA
(
LPSTR
path
,
UINT
count
)
{
if
(
path
)
lstrcpynA
(
path
,
DIR_Windows
.
short_name
,
count
);
return
strlen
(
DIR_Windows
.
short_name
);
UINT
len
=
strlen
(
DIR_Windows
.
short_name
)
+
1
;
if
(
path
&&
count
>=
len
)
{
strcpy
(
path
,
DIR_Windows
.
short_name
);
len
--
;
}
return
len
;
}
/***********************************************************************
* GetWindowsDirectoryW (KERNEL32.@)
*
* Return value:
* If buffer is large enough to hold full path and terminating '\0' character
* function copies path to buffer and returns length of the path without '\0'.
* Otherwise function returns required size including '\0' character and
* does not touch the buffer.
*/
UINT
WINAPI
GetWindowsDirectoryW
(
LPWSTR
path
,
UINT
count
)
{
UINT
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
DIR_Windows
.
short_name
,
-
1
,
NULL
,
0
);
if
(
path
&&
count
)
if
(
path
&&
count
>=
len
)
{
if
(
!
MultiByteToWideChar
(
CP_ACP
,
0
,
DIR_Windows
.
short_name
,
-
1
,
path
,
count
))
path
[
count
-
1
]
=
0
;
MultiByteToWideChar
(
CP_ACP
,
0
,
DIR_Windows
.
short_name
,
-
1
,
path
,
count
);
len
--
;
}
return
len
;
}
...
...
@@ -313,24 +326,33 @@ UINT16 WINAPI GetSystemDirectory16( LPSTR path, UINT16 count )
/***********************************************************************
* GetSystemDirectoryA (KERNEL32.@)
*
* See comment for GetWindowsDirectoryW.
*/
UINT
WINAPI
GetSystemDirectoryA
(
LPSTR
path
,
UINT
count
)
{
if
(
path
)
lstrcpynA
(
path
,
DIR_System
.
short_name
,
count
);
return
strlen
(
DIR_System
.
short_name
);
UINT
len
=
strlen
(
DIR_System
.
short_name
)
+
1
;
if
(
path
&&
count
>=
len
)
{
strcpy
(
path
,
DIR_System
.
short_name
);
len
--
;
}
return
len
;
}
/***********************************************************************
* GetSystemDirectoryW (KERNEL32.@)
*
* See comment for GetWindowsDirectoryW.
*/
UINT
WINAPI
GetSystemDirectoryW
(
LPWSTR
path
,
UINT
count
)
{
UINT
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
DIR_System
.
short_name
,
-
1
,
NULL
,
0
);
if
(
path
&&
count
)
if
(
path
&&
count
>=
len
)
{
if
(
!
MultiByteToWideChar
(
CP_ACP
,
0
,
DIR_System
.
short_name
,
-
1
,
path
,
count
))
path
[
count
-
1
]
=
0
;
MultiByteToWideChar
(
CP_ACP
,
0
,
DIR_System
.
short_name
,
-
1
,
path
,
count
);
len
--
;
}
return
len
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment