kernel32: Add implementation of GetSystemWow64DirectoryA/W.

This commit is contained in:
Alexandre Julliard 2009-07-07 11:42:03 +02:00
parent 12c90b04dc
commit 03d6da0894
4 changed files with 41 additions and 6 deletions

View File

@ -71,6 +71,7 @@ extern HANDLE dos_handles[DOS_TABLE_SIZE];
extern const WCHAR *DIR_Windows;
extern const WCHAR *DIR_System;
extern const WCHAR *DIR_SysWow64;
extern VOID SYSLEVEL_CheckNotLevel( INT level );

View File

@ -1521,10 +1521,22 @@ UINT WINAPI GetSystemDirectoryA( LPSTR path, UINT count )
* - On Win32 we should returns ERROR_CALL_NOT_IMPLEMENTED
* - On Win64 we should returns the SysWow64 (system64) directory
*/
UINT WINAPI GetSystemWow64DirectoryW( LPWSTR lpBuffer, UINT uSize )
UINT WINAPI GetSystemWow64DirectoryW( LPWSTR path, UINT count )
{
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
return 0;
UINT len;
if (!DIR_SysWow64)
{
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
return 0;
}
len = strlenW( DIR_SysWow64 ) + 1;
if (path && count >= len)
{
strcpyW( path, DIR_SysWow64 );
len--;
}
return len;
}
@ -1533,10 +1545,14 @@ UINT WINAPI GetSystemWow64DirectoryW( LPWSTR lpBuffer, UINT uSize )
*
* See comment for GetWindowsWow64DirectoryW.
*/
UINT WINAPI GetSystemWow64DirectoryA( LPSTR lpBuffer, UINT uSize )
UINT WINAPI GetSystemWow64DirectoryA( LPSTR path, UINT count )
{
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
return 0;
if (!DIR_SysWow64)
{
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
return 0;
}
return copy_filename_WtoA( DIR_SysWow64, path, count );
}

View File

@ -76,11 +76,13 @@ static UINT process_error_mode;
static DWORD shutdown_flags = 0;
static DWORD shutdown_priority = 0x280;
static DWORD process_dword;
static BOOL is_wow64;
HMODULE kernel32_handle = 0;
const WCHAR *DIR_Windows = NULL;
const WCHAR *DIR_System = NULL;
const WCHAR *DIR_SysWow64 = NULL;
/* Process flags */
#define PDB32_DEBUGGED 0x0001 /* Process is being debugged */
@ -822,6 +824,7 @@ static void init_windows_dirs(void)
static const WCHAR winsysdirW[] = {'w','i','n','s','y','s','d','i','r',0};
static const WCHAR default_windirW[] = {'C',':','\\','w','i','n','d','o','w','s',0};
static const WCHAR default_sysdirW[] = {'\\','s','y','s','t','e','m','3','2',0};
static const WCHAR default_syswow64W[] = {'\\','s','y','s','w','o','w','6','4',0};
DWORD len;
WCHAR *buffer;
@ -849,6 +852,17 @@ static void init_windows_dirs(void)
DIR_System = buffer;
}
#ifndef _WIN64 /* SysWow64 is always defined on 64-bit */
if (is_wow64)
#endif
{
len = strlenW( DIR_Windows );
buffer = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) + sizeof(default_syswow64W) );
memcpy( buffer, DIR_Windows, len * sizeof(WCHAR) );
memcpy( buffer + len, default_syswow64W, sizeof(default_syswow64W) );
DIR_SysWow64 = buffer;
}
if (!CreateDirectoryW( DIR_Windows, NULL ) && GetLastError() != ERROR_ALREADY_EXISTS)
ERR( "directory %s could not be created, error %u\n",
debugstr_w(DIR_Windows), GetLastError() );
@ -1010,6 +1024,7 @@ void CDECL __wine_kernel_init(void)
setbuf(stdout,NULL);
setbuf(stderr,NULL);
kernel32_handle = GetModuleHandleW(kernel32W);
IsWow64Process( GetCurrentProcess(), &is_wow64 );
LOCALE_Init();

View File

@ -1726,6 +1726,9 @@ WINBASEAPI VOID WINAPI GetSystemTimeAsFileTime(LPFILETIME);
WINBASEAPI UINT WINAPI GetSystemWindowsDirectoryA(LPSTR,UINT);
WINBASEAPI UINT WINAPI GetSystemWindowsDirectoryW(LPWSTR,UINT);
#define GetSystemWindowsDirectory WINELIB_NAME_AW(GetSystemWindowsDirectory)
WINBASEAPI UINT WINAPI GetSystemWow64DirectoryA(LPSTR,UINT);
WINBASEAPI UINT WINAPI GetSystemWow64DirectoryW(LPWSTR,UINT);
#define GetSystemWow64Directory WINELIB_NAME_AW(GetSystemWow64Directory)
WINBASEAPI DWORD WINAPI GetTapeParameters(HANDLE,DWORD,LPDWORD,LPVOID);
WINBASEAPI DWORD WINAPI GetTapePosition(HANDLE,DWORD,LPDWORD,LPDWORD,LPDWORD);
WINBASEAPI DWORD WINAPI GetTapeStatus(HANDLE);