Made wine_get_unix_file_name take a Unicode string pointer.
This commit is contained in:
parent
a938cbeb73
commit
5bf3a2669b
|
@ -618,7 +618,7 @@ static void LoadReplaceList(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static BOOL ReadFontDir(char *dirname)
|
static BOOL ReadFontDir(const char *dirname)
|
||||||
{
|
{
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
struct dirent *dent;
|
struct dirent *dent;
|
||||||
|
@ -724,17 +724,13 @@ INT WineEngAddFontResourceEx(LPCWSTR file, DWORD flags, PVOID pdv)
|
||||||
{
|
{
|
||||||
if (ft_handle) /* do it only if we have freetype up and running */
|
if (ft_handle) /* do it only if we have freetype up and running */
|
||||||
{
|
{
|
||||||
DWORD len = WideCharToMultiByte(CP_ACP, 0, file, -1, NULL, 0, NULL, NULL);
|
|
||||||
LPSTR fileA = HeapAlloc(GetProcessHeap(), 0, len);
|
|
||||||
char unixname[MAX_PATH];
|
char unixname[MAX_PATH];
|
||||||
WideCharToMultiByte(CP_ACP, 0, file, -1, fileA, len, NULL, NULL);
|
|
||||||
|
|
||||||
if(flags)
|
if(flags)
|
||||||
FIXME("Ignoring flags %lx\n", flags);
|
FIXME("Ignoring flags %lx\n", flags);
|
||||||
|
|
||||||
if(wine_get_unix_file_name(fileA, unixname, sizeof(unixname)))
|
if(wine_get_unix_file_name(file, unixname, sizeof(unixname)))
|
||||||
AddFontFileToList(unixname, NULL);
|
AddFontFileToList(unixname, NULL);
|
||||||
HeapFree(GetProcessHeap(), 0, fileA);
|
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -756,11 +752,11 @@ BOOL WineEngRemoveFontResourceEx(LPCWSTR file, DWORD flags, PVOID pdv)
|
||||||
*/
|
*/
|
||||||
BOOL WineEngInit(void)
|
BOOL WineEngInit(void)
|
||||||
{
|
{
|
||||||
|
static const WCHAR fontsW[] = {'\\','F','o','n','t','s','\0'};
|
||||||
HKEY hkey;
|
HKEY hkey;
|
||||||
DWORD valuelen, datalen, i = 0, type, dlen, vlen;
|
DWORD valuelen, datalen, i = 0, type, dlen, vlen;
|
||||||
LPSTR value;
|
|
||||||
LPVOID data;
|
LPVOID data;
|
||||||
char windowsdir[MAX_PATH];
|
WCHAR windowsdir[MAX_PATH];
|
||||||
char unixname[MAX_PATH];
|
char unixname[MAX_PATH];
|
||||||
|
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
|
@ -826,8 +822,8 @@ BOOL WineEngInit(void)
|
||||||
TRACE("FreeType version is %d.%d.%d\n",FT_Version.major,FT_Version.minor,FT_Version.patch);
|
TRACE("FreeType version is %d.%d.%d\n",FT_Version.major,FT_Version.minor,FT_Version.patch);
|
||||||
|
|
||||||
/* load in the fonts from %WINDOWSDIR%\\Fonts first of all */
|
/* load in the fonts from %WINDOWSDIR%\\Fonts first of all */
|
||||||
GetWindowsDirectoryA(windowsdir, sizeof(windowsdir));
|
GetWindowsDirectoryW(windowsdir, sizeof(windowsdir) / sizeof(WCHAR));
|
||||||
strcat(windowsdir, "\\Fonts");
|
strcatW(windowsdir, fontsW);
|
||||||
if(wine_get_unix_file_name(windowsdir, unixname, sizeof(unixname)))
|
if(wine_get_unix_file_name(windowsdir, unixname, sizeof(unixname)))
|
||||||
ReadFontDir(unixname);
|
ReadFontDir(unixname);
|
||||||
|
|
||||||
|
@ -837,19 +833,20 @@ BOOL WineEngInit(void)
|
||||||
if(RegOpenKeyA(HKEY_LOCAL_MACHINE,
|
if(RegOpenKeyA(HKEY_LOCAL_MACHINE,
|
||||||
"Software\\Microsoft\\Windows\\CurrentVersion\\Fonts",
|
"Software\\Microsoft\\Windows\\CurrentVersion\\Fonts",
|
||||||
&hkey) == ERROR_SUCCESS) {
|
&hkey) == ERROR_SUCCESS) {
|
||||||
RegQueryInfoKeyA(hkey, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
LPWSTR valueW;
|
||||||
|
RegQueryInfoKeyW(hkey, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
&valuelen, &datalen, NULL, NULL);
|
&valuelen, &datalen, NULL, NULL);
|
||||||
|
|
||||||
valuelen++; /* returned value doesn't include room for '\0' */
|
valuelen++; /* returned value doesn't include room for '\0' */
|
||||||
value = HeapAlloc(GetProcessHeap(), 0, valuelen);
|
valueW = HeapAlloc(GetProcessHeap(), 0, valuelen * sizeof(WCHAR));
|
||||||
data = HeapAlloc(GetProcessHeap(), 0, datalen);
|
data = HeapAlloc(GetProcessHeap(), 0, datalen * sizeof(WCHAR));
|
||||||
|
|
||||||
dlen = datalen;
|
dlen = datalen * sizeof(WCHAR);
|
||||||
vlen = valuelen;
|
vlen = valuelen;
|
||||||
while(RegEnumValueA(hkey, i++, value, &vlen, NULL, &type, data,
|
while(RegEnumValueW(hkey, i++, valueW, &vlen, NULL, &type, data,
|
||||||
&dlen) == ERROR_SUCCESS) {
|
&dlen) == ERROR_SUCCESS) {
|
||||||
if(((LPSTR)data)[0] && ((LPSTR)data)[1] == ':')
|
if(((LPWSTR)data)[0] && ((LPWSTR)data)[1] == ':')
|
||||||
if(wine_get_unix_file_name((LPSTR)data, unixname, sizeof(unixname)))
|
if(wine_get_unix_file_name((LPWSTR)data, unixname, sizeof(unixname)))
|
||||||
AddFontFileToList(unixname, NULL);
|
AddFontFileToList(unixname, NULL);
|
||||||
|
|
||||||
/* reset dlen and vlen */
|
/* reset dlen and vlen */
|
||||||
|
@ -857,7 +854,7 @@ BOOL WineEngInit(void)
|
||||||
vlen = valuelen;
|
vlen = valuelen;
|
||||||
}
|
}
|
||||||
HeapFree(GetProcessHeap(), 0, data);
|
HeapFree(GetProcessHeap(), 0, data);
|
||||||
HeapFree(GetProcessHeap(), 0, value);
|
HeapFree(GetProcessHeap(), 0, valueW);
|
||||||
RegCloseKey(hkey);
|
RegCloseKey(hkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -867,7 +864,7 @@ BOOL WineEngInit(void)
|
||||||
if(RegOpenKeyA(HKEY_LOCAL_MACHINE,
|
if(RegOpenKeyA(HKEY_LOCAL_MACHINE,
|
||||||
"Software\\Wine\\Wine\\Config\\FontDirs",
|
"Software\\Wine\\Wine\\Config\\FontDirs",
|
||||||
&hkey) == ERROR_SUCCESS) {
|
&hkey) == ERROR_SUCCESS) {
|
||||||
|
LPSTR value;
|
||||||
RegQueryInfoKeyA(hkey, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
RegQueryInfoKeyA(hkey, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
&valuelen, &datalen, NULL, NULL);
|
&valuelen, &datalen, NULL, NULL);
|
||||||
|
|
||||||
|
|
|
@ -511,6 +511,7 @@ static int CreateSpoolFile(LPCSTR pszOutput)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char buffer[MAX_PATH];
|
char buffer[MAX_PATH];
|
||||||
|
WCHAR psCmdPW[MAX_PATH];
|
||||||
|
|
||||||
TRACE("Just assume it's a file\n");
|
TRACE("Just assume it's a file\n");
|
||||||
|
|
||||||
|
@ -518,7 +519,8 @@ static int CreateSpoolFile(LPCSTR pszOutput)
|
||||||
* The file name can be dos based, we have to find its
|
* The file name can be dos based, we have to find its
|
||||||
* Unix correspondant file name
|
* Unix correspondant file name
|
||||||
*/
|
*/
|
||||||
wine_get_unix_file_name(psCmdP, buffer, sizeof(buffer));
|
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 ((fd = open(buffer, O_CREAT | O_TRUNC | O_WRONLY , 0600)) < 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1132,7 +1132,7 @@
|
||||||
@ varargs __wine_call_from_16_regs()
|
@ varargs __wine_call_from_16_regs()
|
||||||
|
|
||||||
# Unix files
|
# Unix files
|
||||||
@ stdcall wine_get_unix_file_name(str ptr long)
|
@ stdcall wine_get_unix_file_name(wstr ptr long)
|
||||||
|
|
||||||
# Init code
|
# Init code
|
||||||
@ cdecl __wine_kernel_init()
|
@ cdecl __wine_kernel_init()
|
||||||
|
|
|
@ -456,13 +456,14 @@ static void DOSCONF_Parse(char *menuname)
|
||||||
DOSCONF *DOSCONF_GetConfig(void)
|
DOSCONF *DOSCONF_GetConfig(void)
|
||||||
{
|
{
|
||||||
HKEY hkey;
|
HKEY hkey;
|
||||||
CHAR filename[MAX_PATH];
|
WCHAR filename[MAX_PATH];
|
||||||
|
static const WCHAR configW[] = {'c','o','n','f','i','g','.','s','y','s',0};
|
||||||
|
|
||||||
if (DOSCONF_loaded)
|
if (DOSCONF_loaded)
|
||||||
return &DOSCONF_config;
|
return &DOSCONF_config;
|
||||||
|
|
||||||
/* default value */
|
/* default value */
|
||||||
strcpy( filename, "*" );
|
filename[0] = '*'; filename[1] = '\0';
|
||||||
|
|
||||||
if (!RegOpenKeyA(HKEY_LOCAL_MACHINE,
|
if (!RegOpenKeyA(HKEY_LOCAL_MACHINE,
|
||||||
"Software\\Wine\\Wine\\Config\\wine",
|
"Software\\Wine\\Wine\\Config\\wine",
|
||||||
|
@ -471,11 +472,11 @@ DOSCONF *DOSCONF_GetConfig(void)
|
||||||
DWORD type;
|
DWORD type;
|
||||||
DWORD count = sizeof(filename);
|
DWORD count = sizeof(filename);
|
||||||
|
|
||||||
RegQueryValueExA(hkey, "config.sys", 0, &type, filename, &count);
|
RegQueryValueExW(hkey, configW, 0, &type, (LPBYTE)filename, &count);
|
||||||
RegCloseKey(hkey);
|
RegCloseKey(hkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(filename, "*") && *filename != '\0')
|
if ((filename[0] != '*' || filename[1] != '\0') && *filename != '\0')
|
||||||
{
|
{
|
||||||
CHAR fullname[MAX_PATH];
|
CHAR fullname[MAX_PATH];
|
||||||
|
|
||||||
|
@ -492,7 +493,7 @@ DOSCONF *DOSCONF_GetConfig(void)
|
||||||
{
|
{
|
||||||
WARN( "Couldn't open config.sys file given as %s in"
|
WARN( "Couldn't open config.sys file given as %s in"
|
||||||
" configuration file, section [wine]!\n",
|
" configuration file, section [wine]!\n",
|
||||||
filename );
|
debugstr_w(filename) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1697,15 +1697,12 @@ DWORD WINAPI GetFullPathNameW( LPCWSTR name, DWORD len, LPWSTR buffer,
|
||||||
* wine_get_unix_file_name (KERNEL32.@) Not a Windows API
|
* wine_get_unix_file_name (KERNEL32.@) Not a Windows API
|
||||||
*
|
*
|
||||||
* Return the full Unix file name for a given path.
|
* Return the full Unix file name for a given path.
|
||||||
* FIXME: convert dos file name to unicode
|
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI wine_get_unix_file_name( LPCSTR dos, LPSTR buffer, DWORD len )
|
BOOL WINAPI wine_get_unix_file_name( LPCWSTR dosW, LPSTR buffer, DWORD len )
|
||||||
{
|
{
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
DOS_FULL_NAME path;
|
DOS_FULL_NAME path;
|
||||||
WCHAR dosW[MAX_PATHNAME_LEN];
|
|
||||||
|
|
||||||
MultiByteToWideChar(CP_ACP, 0, dos, -1, dosW, MAX_PATHNAME_LEN);
|
|
||||||
ret = DOSFS_GetFullName( dosW, FALSE, &path );
|
ret = DOSFS_GetFullName( dosW, FALSE, &path );
|
||||||
if (ret && len)
|
if (ret && len)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1868,7 +1868,7 @@ VOID WINAPI _LeaveSysLevel(SYSLEVEL*);
|
||||||
|
|
||||||
/* Wine internal functions */
|
/* Wine internal functions */
|
||||||
|
|
||||||
BOOL WINAPI wine_get_unix_file_name( LPCSTR dos, LPSTR buffer, DWORD len );
|
BOOL WINAPI wine_get_unix_file_name( LPCWSTR dos, LPSTR buffer, DWORD len );
|
||||||
|
|
||||||
|
|
||||||
/* a few optimizations for i386/gcc */
|
/* a few optimizations for i386/gcc */
|
||||||
|
|
|
@ -325,9 +325,11 @@ static BOOL ExtractFromEXEDLL(const char *szFileName, int nIndex, const char *sz
|
||||||
/* get the Unix file name for a given path, allocating the string */
|
/* get the Unix file name for a given path, allocating the string */
|
||||||
inline static char *get_unix_file_name( const char *dos )
|
inline static char *get_unix_file_name( const char *dos )
|
||||||
{
|
{
|
||||||
|
WCHAR dosW[MAX_PATH];
|
||||||
char buffer[MAX_PATH], *ret;
|
char buffer[MAX_PATH], *ret;
|
||||||
|
|
||||||
if (!wine_get_unix_file_name( dos, buffer, sizeof(buffer) )) return NULL;
|
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 );
|
ret = HeapAlloc( GetProcessHeap(), 0, lstrlenA( buffer ) + 1 );
|
||||||
lstrcpyA( ret, buffer );
|
lstrcpyA( ret, buffer );
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -36,7 +36,7 @@ static char *progname;
|
||||||
|
|
||||||
/* Wine specific functions */
|
/* Wine specific functions */
|
||||||
extern BOOL process_init(char *argv[]);
|
extern BOOL process_init(char *argv[]);
|
||||||
typedef BOOL (WINAPI *wine_get_unix_file_name_t) ( LPCSTR dos, LPSTR buffer, DWORD len );
|
typedef BOOL (WINAPI *wine_get_unix_file_name_t) ( LPCWSTR dos, LPSTR buffer, DWORD len );
|
||||||
/*
|
/*
|
||||||
* handle an option
|
* handle an option
|
||||||
*/
|
*/
|
||||||
|
@ -161,7 +161,10 @@ int main(int argc, char *argv[])
|
||||||
printf("%s\n", path);
|
printf("%s\n", path);
|
||||||
}
|
}
|
||||||
if (outputformats & UNIXFORMAT) {
|
if (outputformats & UNIXFORMAT) {
|
||||||
wine_get_unix_file_name_ptr(argv[i], path, sizeof(path));
|
WCHAR dosW[MAX_PATH];
|
||||||
|
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, argv[i], -1, dosW, MAX_PATH);
|
||||||
|
wine_get_unix_file_name_ptr(dosW, path, sizeof(path));
|
||||||
printf("%s\n", path);
|
printf("%s\n", path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue