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
1cb0cf4c
Commit
1cb0cf4c
authored
Apr 14, 2004
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved wine_get_unix_file_name implementation to ntdll, and changed it
to return an allocated buffer instead of a fixed size one.
parent
ac05d0dd
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
75 additions
and
56 deletions
+75
-56
freetype.c
dlls/gdi/freetype.c
+14
-5
printdrv.c
dlls/gdi/printdrv.c
+8
-6
kernel32.spec
dlls/kernel/kernel32.spec
+1
-1
process.c
dlls/kernel/process.c
+14
-13
directory.c
dlls/ntdll/directory.c
+20
-0
ntdll.spec
dlls/ntdll/ntdll.spec
+3
-0
dosconf.c
dlls/winedos/dosconf.c
+5
-2
dos_fs.c
files/dos_fs.c
+0
-20
winbase.h
include/winbase.h
+1
-1
winemenubuilder.c
programs/winemenubuilder/winemenubuilder.c
+1
-5
winepath.c
programs/winepath/winepath.c
+8
-3
No files found.
dlls/gdi/freetype.c
View file @
1cb0cf4c
...
...
@@ -851,13 +851,16 @@ INT WineEngAddFontResourceEx(LPCWSTR file, DWORD flags, PVOID pdv)
{
if
(
ft_handle
)
/* do it only if we have freetype up and running */
{
char
unixname
[
MAX_PATH
]
;
char
*
unixname
;
if
(
flags
)
FIXME
(
"Ignoring flags %lx
\n
"
,
flags
);
if
(
wine_get_unix_file_name
(
file
,
unixname
,
sizeof
(
unixname
)))
if
((
unixname
=
wine_get_unix_file_name
(
file
)))
{
AddFontFileToList
(
unixname
,
NULL
,
FALSE
);
HeapFree
(
GetProcessHeap
(),
0
,
unixname
);
}
}
return
1
;
}
...
...
@@ -884,7 +887,7 @@ BOOL WineEngInit(void)
DWORD
valuelen
,
datalen
,
i
=
0
,
type
,
dlen
,
vlen
;
LPVOID
data
;
WCHAR
windowsdir
[
MAX_PATH
];
char
unixname
[
MAX_PATH
]
;
char
*
unixname
;
HANDLE
font_mutex
;
TRACE
(
"
\n
"
);
...
...
@@ -958,8 +961,11 @@ BOOL WineEngInit(void)
/* load in the fonts from %WINDOWSDIR%\\Fonts first of all */
GetWindowsDirectoryW
(
windowsdir
,
sizeof
(
windowsdir
)
/
sizeof
(
WCHAR
));
strcatW
(
windowsdir
,
fontsW
);
if
(
wine_get_unix_file_name
(
windowsdir
,
unixname
,
sizeof
(
unixname
)))
if
((
unixname
=
wine_get_unix_file_name
(
windowsdir
)))
{
ReadFontDir
(
unixname
,
FALSE
);
HeapFree
(
GetProcessHeap
(),
0
,
unixname
);
}
/* now look under HKLM\Software\Microsoft\Windows[ NT]\CurrentVersion\Fonts
for any fonts not installed in %WINDOWSDIR%\Fonts. They will have their
...
...
@@ -981,8 +987,11 @@ BOOL WineEngInit(void)
while
(
RegEnumValueW
(
hkey
,
i
++
,
valueW
,
&
vlen
,
NULL
,
&
type
,
data
,
&
dlen
)
==
ERROR_SUCCESS
)
{
if
(((
LPWSTR
)
data
)[
0
]
&&
((
LPWSTR
)
data
)[
1
]
==
':'
)
if
(
wine_get_unix_file_name
((
LPWSTR
)
data
,
unixname
,
sizeof
(
unixname
)))
if
((
unixname
=
wine_get_unix_file_name
((
LPWSTR
)
data
)))
{
AddFontFileToList
(
unixname
,
NULL
,
FALSE
);
HeapFree
(
GetProcessHeap
(),
0
,
unixname
);
}
/* reset dlen and vlen */
dlen
=
datalen
;
vlen
=
valuelen
;
...
...
dlls/gdi/printdrv.c
View file @
1cb0cf4c
...
...
@@ -511,7 +511,7 @@ static int CreateSpoolFile(LPCSTR pszOutput)
}
else
{
char
buffer
[
MAX_PATH
]
;
char
*
buffer
;
WCHAR
psCmdPW
[
MAX_PATH
];
TRACE
(
"Just assume it's a file
\n
"
);
...
...
@@ -521,12 +521,14 @@ static int CreateSpoolFile(LPCSTR pszOutput)
* Unix correspondant file name
*/
MultiByteToWideChar
(
CP_ACP
,
0
,
psCmdP
,
-
1
,
psCmdPW
,
MAX_PATH
);
wine_get_unix_file_name
(
psCmdPW
,
buffer
,
sizeof
(
buffer
));
if
((
fd
=
open
(
buffer
,
O_CREAT
|
O_TRUNC
|
O_WRONLY
,
0600
))
<
0
)
if
((
buffer
=
wine_get_unix_file_name
(
psCmdPW
)))
{
ERR
(
"Failed to create spool file '%s' ('%s'). (error %s)
\n
"
,
buffer
,
psCmdP
,
strerror
(
errno
));
if
((
fd
=
open
(
buffer
,
O_CREAT
|
O_TRUNC
|
O_WRONLY
,
0600
))
<
0
)
{
ERR
(
"Failed to create spool file '%s' ('%s'). (error %s)
\n
"
,
buffer
,
psCmdP
,
strerror
(
errno
));
}
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
}
}
return
fd
;
...
...
dlls/kernel/kernel32.spec
View file @
1cb0cf4c
...
...
@@ -1154,7 +1154,7 @@
@ varargs __wine_call_from_16_regs()
# Unix files
@
stdcall wine_get_unix_file_name(wstr ptr long)
@
cdecl wine_get_unix_file_name(wstr) ntdll.wine_get_unix_file_name
# Init code
@ cdecl __wine_kernel_init()
...
...
dlls/kernel/process.c
View file @
1cb0cf4c
...
...
@@ -893,13 +893,13 @@ void __wine_kernel_init(void)
ExitProcess
(
1
);
case
BINARY_UNIX_LIB
:
{
DOS_FULL_NAME
full
_name
;
char
*
unix
_name
;
TRACE
(
"starting Winelib app %s
\n
"
,
debugstr_w
(
main_exe_name
)
);
CloseHandle
(
main_exe_file
);
main_exe_file
=
0
;
if
(
DOSFS_GetFullName
(
main_exe_name
,
TRUE
,
&
full_name
)
&&
wine_dlopen
(
full_name
.
long
_name
,
RTLD_NOW
,
error
,
sizeof
(
error
)
))
if
(
(
unix_name
=
wine_get_unix_file_name
(
main_exe_name
)
)
&&
wine_dlopen
(
unix
_name
,
RTLD_NOW
,
error
,
sizeof
(
error
)
))
{
static
const
WCHAR
soW
[]
=
{
'.'
,
's'
,
'o'
,
0
};
if
((
p
=
strrchrW
(
main_exe_name
,
'.'
))
&&
!
strcmpW
(
p
,
soW
))
...
...
@@ -908,6 +908,7 @@ void __wine_kernel_init(void)
/* update the unicode string */
RtlInitUnicodeString
(
&
peb
->
ProcessParameters
->
ImagePathName
,
main_exe_name
);
}
HeapFree
(
GetProcessHeap
(),
0
,
unix_name
);
goto
found
;
}
MESSAGE
(
"wine: could not load %s: %s
\n
"
,
debugstr_w
(
main_exe_name
),
error
);
...
...
@@ -1606,8 +1607,7 @@ BOOL WINAPI CreateProcessW( LPCWSTR app_name, LPWSTR cmd_line, LPSECURITY_ATTRIB
{
BOOL
retv
=
FALSE
;
HANDLE
hFile
=
0
;
const
char
*
unixdir
=
NULL
;
DOS_FULL_NAME
full_dir
;
char
*
unixdir
=
NULL
;
WCHAR
name
[
MAX_PATH
];
WCHAR
*
tidy_cmdline
,
*
p
,
*
envW
=
env
;
...
...
@@ -1629,15 +1629,12 @@ BOOL WINAPI CreateProcessW( LPCWSTR app_name, LPWSTR cmd_line, LPSECURITY_ATTRIB
if
(
cur_dir
)
{
if
(
DOSFS_GetFullName
(
cur_dir
,
TRUE
,
&
full_dir
))
unixdir
=
full_dir
.
long_name
;
unixdir
=
wine_get_unix_file_name
(
cur_dir
)
;
}
else
{
WCHAR
buf
[
MAX_PATH
];
if
(
GetCurrentDirectoryW
(
MAX_PATH
,
buf
))
{
if
(
DOSFS_GetFullName
(
buf
,
TRUE
,
&
full_dir
))
unixdir
=
full_dir
.
long_name
;
}
if
(
GetCurrentDirectoryW
(
MAX_PATH
,
buf
))
unixdir
=
wine_get_unix_file_name
(
buf
);
}
if
(
env
&&
!
(
flags
&
CREATE_UNICODE_ENVIRONMENT
))
/* convert environment to unicode */
...
...
@@ -1715,12 +1712,15 @@ BOOL WINAPI CreateProcessW( LPCWSTR app_name, LPWSTR cmd_line, LPSECURITY_ATTRIB
case
BINARY_UNIX_EXE
:
{
/* unknown file, try as unix executable */
DOS_FULL_NAME
full
_name
;
char
*
unix
_name
;
TRACE
(
"starting %s as Unix binary
\n
"
,
debugstr_w
(
name
)
);
if
(
DOSFS_GetFullName
(
name
,
TRUE
,
&
full_name
))
retv
=
(
fork_and_exec
(
full_name
.
long_name
,
tidy_cmdline
,
envW
,
unixdir
)
!=
-
1
);
if
((
unix_name
=
wine_get_unix_file_name
(
name
)))
{
retv
=
(
fork_and_exec
(
unix_name
,
tidy_cmdline
,
envW
,
unixdir
)
!=
-
1
);
HeapFree
(
GetProcessHeap
(),
0
,
unix_name
);
}
}
break
;
}
...
...
@@ -1729,6 +1729,7 @@ BOOL WINAPI CreateProcessW( LPCWSTR app_name, LPWSTR cmd_line, LPSECURITY_ATTRIB
done:
if
(
tidy_cmdline
!=
cmd_line
)
HeapFree
(
GetProcessHeap
(),
0
,
tidy_cmdline
);
if
(
envW
!=
env
)
HeapFree
(
GetProcessHeap
(),
0
,
envW
);
if
(
unixdir
)
HeapFree
(
GetProcessHeap
(),
0
,
unixdir
);
return
retv
;
}
...
...
dlls/ntdll/directory.c
View file @
1cb0cf4c
...
...
@@ -915,6 +915,26 @@ done:
}
/***********************************************************************
* wine_get_unix_file_name (NTDLL.@) Not a Windows API
*
* Return the full Unix file name for a given path.
* Returned buffer must be freed by caller.
*/
char
*
wine_get_unix_file_name
(
LPCWSTR
dosW
)
{
UNICODE_STRING
nt_name
;
ANSI_STRING
unix_name
;
NTSTATUS
status
;
if
(
!
RtlDosPathNameToNtPathName_U
(
dosW
,
&
nt_name
,
NULL
,
NULL
))
return
NULL
;
status
=
DIR_nt_to_unix
(
&
nt_name
,
&
unix_name
,
FALSE
,
FALSE
);
RtlFreeUnicodeString
(
&
nt_name
);
if
(
status
)
return
NULL
;
return
unix_name
.
Buffer
;
}
/******************************************************************
* RtlDoesFileExists_U (NTDLL.@)
*/
...
...
dlls/ntdll/ntdll.spec
View file @
1cb0cf4c
...
...
@@ -1123,6 +1123,9 @@
# signal handling
@ cdecl __wine_set_signal_handler(long ptr)
# Filesystem
@ cdecl wine_get_unix_file_name(wstr)
################################################################
# Wine dll separation hacks, these will go away, don't use them
#
...
...
dlls/winedos/dosconf.c
View file @
1cb0cf4c
...
...
@@ -478,10 +478,13 @@ DOSCONF *DOSCONF_GetConfig(void)
if
((
filename
[
0
]
!=
'*'
||
filename
[
1
]
!=
'\0'
)
&&
*
filename
!=
'\0'
)
{
CHAR
fullname
[
MAX_PATH
]
;
char
*
fullname
;
if
(
wine_get_unix_file_name
(
filename
,
fullname
,
sizeof
(
fullname
)))
if
((
fullname
=
wine_get_unix_file_name
(
filename
)))
{
DOSCONF_fd
=
fopen
(
fullname
,
"r"
);
HeapFree
(
GetProcessHeap
(),
0
,
fullname
);
}
if
(
DOSCONF_fd
)
{
...
...
files/dos_fs.c
View file @
1cb0cf4c
...
...
@@ -849,26 +849,6 @@ BOOL DOSFS_GetFullName( LPCWSTR name, BOOL check_last, DOS_FULL_NAME *full )
/***********************************************************************
* wine_get_unix_file_name (KERNEL32.@) Not a Windows API
*
* Return the full Unix file name for a given path.
*/
BOOL
WINAPI
wine_get_unix_file_name
(
LPCWSTR
dosW
,
LPSTR
buffer
,
DWORD
len
)
{
BOOL
ret
;
DOS_FULL_NAME
path
;
ret
=
DOSFS_GetFullName
(
dosW
,
FALSE
,
&
path
);
if
(
ret
&&
len
)
{
strncpy
(
buffer
,
path
.
long_name
,
len
);
buffer
[
len
-
1
]
=
0
;
/* ensure 0 termination */
}
return
ret
;
}
/***********************************************************************
* MulDiv (KERNEL32.@)
* RETURNS
* Result of multiplication and division
...
...
include/winbase.h
View file @
1cb0cf4c
...
...
@@ -1988,7 +1988,7 @@ VOID WINAPI _LeaveSysLevel(SYSLEVEL*);
/* Wine internal functions */
BOOL
WINAPI
wine_get_unix_file_name
(
LPCWSTR
dos
,
LPSTR
buffer
,
DWORD
len
);
extern
char
*
wine_get_unix_file_name
(
LPCWSTR
dos
);
/* a few optimizations for i386/gcc */
...
...
programs/winemenubuilder/winemenubuilder.c
View file @
1cb0cf4c
...
...
@@ -326,13 +326,9 @@ static BOOL ExtractFromEXEDLL(const char *szFileName, int nIndex, const char *sz
inline
static
char
*
get_unix_file_name
(
const
char
*
dos
)
{
WCHAR
dosW
[
MAX_PATH
];
char
buffer
[
MAX_PATH
],
*
ret
;
MultiByteToWideChar
(
CP_ACP
,
0
,
dos
,
-
1
,
dosW
,
MAX_PATH
);
if
(
!
wine_get_unix_file_name
(
dosW
,
buffer
,
sizeof
(
buffer
)
))
return
NULL
;
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
lstrlenA
(
buffer
)
+
1
);
lstrcpyA
(
ret
,
buffer
);
return
ret
;
return
wine_get_unix_file_name
(
dosW
);
}
static
int
ExtractFromICO
(
const
char
*
szFileName
,
const
char
*
szXPMFileName
)
...
...
programs/winepath/winepath.c
View file @
1cb0cf4c
...
...
@@ -36,7 +36,7 @@ static char *progname;
/* Wine specific functions */
extern
BOOL
process_init
(
char
*
argv
[]);
typedef
BOOL
(
WINAPI
*
wine_get_unix_file_name_t
)
(
LPCWSTR
dos
,
LPSTR
buffer
,
DWORD
len
);
typedef
LPSTR
(
*
wine_get_unix_file_name_t
)
(
LPCWSTR
dos
);
/*
* handle an option
*/
...
...
@@ -162,10 +162,15 @@ int main(int argc, char *argv[])
}
if
(
outputformats
&
UNIXFORMAT
)
{
WCHAR
dosW
[
MAX_PATH
];
char
*
unix_name
;
MultiByteToWideChar
(
CP_ACP
,
0
,
argv
[
i
],
-
1
,
dosW
,
MAX_PATH
);
wine_get_unix_file_name_ptr
(
dosW
,
path
,
sizeof
(
path
));
printf
(
"%s
\n
"
,
path
);
if
((
unix_name
=
wine_get_unix_file_name_ptr
(
dosW
)))
{
printf
(
"%s
\n
"
,
unix_name
);
HeapFree
(
GetProcessHeap
(),
0
,
unix_name
);
}
else
printf
(
"
\n
"
);
}
}
...
...
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