wbemprox: Add helpers to retrieve the system directory and OS architecture.
This commit is contained in:
parent
d8d6821cd4
commit
381d30ac17
|
@ -831,31 +831,37 @@ static void fill_processor( struct table *table )
|
||||||
table->num_rows = count;
|
table->num_rows = count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const WCHAR *get_osarchitecture(void)
|
||||||
|
{
|
||||||
|
SYSTEM_INFO info;
|
||||||
|
GetNativeSystemInfo( &info );
|
||||||
|
if (info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) return os_64bitW;
|
||||||
|
return os_32bitW;
|
||||||
|
}
|
||||||
|
static WCHAR *get_systemdirectory(void)
|
||||||
|
{
|
||||||
|
void *redir;
|
||||||
|
WCHAR *ret;
|
||||||
|
|
||||||
|
if (!(ret = heap_alloc( MAX_PATH * sizeof(WCHAR) ))) return NULL;
|
||||||
|
Wow64DisableWow64FsRedirection( &redir );
|
||||||
|
GetSystemDirectoryW( ret, MAX_PATH );
|
||||||
|
Wow64RevertWow64FsRedirection( redir );
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static void fill_os( struct table *table )
|
static void fill_os( struct table *table )
|
||||||
{
|
{
|
||||||
struct record_operatingsystem *rec;
|
struct record_operatingsystem *rec;
|
||||||
WCHAR path[MAX_PATH];
|
|
||||||
SYSTEM_INFO info;
|
|
||||||
void *redir;
|
|
||||||
|
|
||||||
if (!(table->data = heap_alloc( sizeof(*rec) ))) return;
|
if (!(table->data = heap_alloc( sizeof(*rec) ))) return;
|
||||||
|
|
||||||
rec = (struct record_operatingsystem *)table->data;
|
rec = (struct record_operatingsystem *)table->data;
|
||||||
rec->caption = os_captionW;
|
rec->caption = os_captionW;
|
||||||
rec->csdversion = os_csdversionW;
|
rec->csdversion = os_csdversionW;
|
||||||
|
rec->osarchitecture = get_osarchitecture();
|
||||||
GetNativeSystemInfo( &info );
|
rec->oslanguage = MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US );
|
||||||
if (info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
|
rec->systemdirectory = get_systemdirectory();
|
||||||
rec->osarchitecture = os_64bitW;
|
|
||||||
else
|
|
||||||
rec->osarchitecture = os_32bitW;
|
|
||||||
|
|
||||||
rec->oslanguage = MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US );
|
|
||||||
|
|
||||||
Wow64DisableWow64FsRedirection( &redir );
|
|
||||||
GetSystemDirectoryW( path, MAX_PATH );
|
|
||||||
Wow64RevertWow64FsRedirection( redir );
|
|
||||||
rec->systemdirectory = heap_strdupW( path );
|
|
||||||
|
|
||||||
TRACE("created 1 row\n");
|
TRACE("created 1 row\n");
|
||||||
table->num_rows = 1;
|
table->num_rows = 1;
|
||||||
|
|
Loading…
Reference in New Issue