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
f2e1c514
Commit
f2e1c514
authored
Jan 25, 2019
by
Hans Leidekker
Committed by
Alexandre Julliard
Jan 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wbemprox: Fix processor caption on AMD 64-bit.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
dfb0c8c9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
27 deletions
+46
-27
builtin.c
dlls/wbemprox/builtin.c
+35
-27
query.c
dlls/wbemprox/tests/query.c
+11
-0
No files found.
dlls/wbemprox/builtin.c
View file @
f2e1c514
...
...
@@ -2842,13 +2842,6 @@ void do_cpuid( unsigned int ax, unsigned int *p )
}
#endif
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
unsigned
int
get_processor_model
(
unsigned
int
reg0
,
unsigned
int
*
stepping
,
unsigned
int
*
family
)
{
unsigned
int
model
,
family_id
=
(
reg0
&
(
0x0f
<<
8
))
>>
8
;
...
...
@@ -2863,6 +2856,32 @@ static unsigned int get_processor_model( unsigned int reg0, unsigned int *steppi
*
stepping
=
reg0
&
0x0f
;
return
model
;
}
static
void
regs_to_str
(
unsigned
int
*
regs
,
unsigned
int
len
,
WCHAR
*
buffer
)
{
unsigned
int
i
;
unsigned
char
*
p
=
(
unsigned
char
*
)
regs
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
buffer
[
i
]
=
*
p
++
;
}
buffer
[
i
]
=
0
;
}
static
void
get_processor_manufacturer
(
WCHAR
*
manufacturer
)
{
unsigned
int
tmp
,
regs
[
4
]
=
{
0
,
0
,
0
,
0
};
do_cpuid
(
0
,
regs
);
tmp
=
regs
[
2
];
/* swap edx and ecx */
regs
[
2
]
=
regs
[
3
];
regs
[
3
]
=
tmp
;
regs_to_str
(
regs
+
1
,
12
,
manufacturer
);
}
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
void
get_processor_caption
(
WCHAR
*
caption
)
{
static
const
WCHAR
fmtW
[]
=
...
...
@@ -2870,9 +2889,17 @@ static void get_processor_caption( WCHAR *caption )
'M'
,
'o'
,
'd'
,
'e'
,
'l'
,
' '
,
'%'
,
'u'
,
' '
,
'S'
,
't'
,
'e'
,
'p'
,
'p'
,
'i'
,
'n'
,
'g'
,
' '
,
'%'
,
'u'
,
0
};
static
const
WCHAR
x86W
[]
=
{
'x'
,
'8'
,
'6'
,
0
};
static
const
WCHAR
intel64W
[]
=
{
'I'
,
'n'
,
't'
,
'e'
,
'l'
,
'6'
,
'4'
,
0
};
const
WCHAR
*
arch
=
(
get_osarchitecture
()
==
os_32bitW
)
?
x86W
:
intel64W
;
static
const
WCHAR
amd64W
[]
=
{
'A'
,
'M'
,
'D'
,
'6'
,
'4'
,
0
};
static
const
WCHAR
authenticamdW
[]
=
{
'A'
,
'u'
,
't'
,
'h'
,
'e'
,
'n'
,
't'
,
'i'
,
'c'
,
'A'
,
'M'
,
'D'
,
0
};
const
WCHAR
*
arch
;
WCHAR
manufacturer
[
13
];
unsigned
int
regs
[
4
]
=
{
0
,
0
,
0
,
0
},
family
,
model
,
stepping
;
get_processor_manufacturer
(
manufacturer
);
if
(
get_osarchitecture
()
==
os_32bitW
)
arch
=
x86W
;
else
if
(
!
strcmpW
(
manufacturer
,
authenticamdW
))
arch
=
amd64W
;
else
arch
=
intel64W
;
do_cpuid
(
1
,
regs
);
model
=
get_processor_model
(
regs
[
0
],
&
stepping
,
&
family
);
...
...
@@ -2903,25 +2930,6 @@ static void get_processor_id( WCHAR *processor_id )
do_cpuid
(
1
,
regs
);
sprintfW
(
processor_id
,
fmtW
,
regs
[
3
],
regs
[
0
]
);
}
static
void
regs_to_str
(
unsigned
int
*
regs
,
unsigned
int
len
,
WCHAR
*
buffer
)
{
unsigned
int
i
;
unsigned
char
*
p
=
(
unsigned
char
*
)
regs
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
buffer
[
i
]
=
*
p
++
;
}
buffer
[
i
]
=
0
;
}
static
void
get_processor_manufacturer
(
WCHAR
*
manufacturer
)
{
unsigned
int
tmp
,
regs
[
4
]
=
{
0
,
0
,
0
,
0
};
do_cpuid
(
0
,
regs
);
tmp
=
regs
[
2
];
/* swap edx and ecx */
regs
[
2
]
=
regs
[
3
];
regs
[
3
]
=
tmp
;
regs_to_str
(
regs
+
1
,
12
,
manufacturer
);
}
static
void
get_processor_name
(
WCHAR
*
name
)
{
unsigned
int
regs
[
4
]
=
{
0
,
0
,
0
,
0
};
...
...
dlls/wbemprox/tests/query.c
View file @
f2e1c514
...
...
@@ -1553,6 +1553,8 @@ static void test_Win32_Processor( IWbemServices *services )
{
static
const
WCHAR
architectureW
[]
=
{
'A'
,
'r'
,
'c'
,
'h'
,
'i'
,
't'
,
'e'
,
'c'
,
't'
,
'u'
,
'r'
,
'e'
,
0
};
static
const
WCHAR
captionW
[]
=
{
'C'
,
'a'
,
'p'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
static
const
WCHAR
familyW
[]
=
{
'F'
,
'a'
,
'm'
,
'i'
,
'l'
,
'y'
,
0
};
static
const
WCHAR
levelW
[]
=
...
...
@@ -1588,6 +1590,15 @@ static void test_Win32_Processor( IWbemServices *services )
type
=
0xdeadbeef
;
VariantInit
(
&
val
);
hr
=
IWbemClassObject_Get
(
obj
,
captionW
,
0
,
&
val
,
&
type
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
V_VT
(
&
val
)
==
VT_BSTR
,
"unexpected variant type 0x%x
\n
"
,
V_VT
(
&
val
)
);
ok
(
type
==
CIM_STRING
,
"unexpected type 0x%x
\n
"
,
type
);
trace
(
"caption %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
val
))
);
VariantClear
(
&
val
);
type
=
0xdeadbeef
;
VariantInit
(
&
val
);
hr
=
IWbemClassObject_Get
(
obj
,
architectureW
,
0
,
&
val
,
&
type
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
V_VT
(
&
val
)
==
VT_I4
,
"unexpected variant type 0x%x
\n
"
,
V_VT
(
&
val
)
);
...
...
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