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
0a66633c
Commit
0a66633c
authored
Nov 18, 2008
by
Francois Gouget
Committed by
Alexandre Julliard
Nov 19, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Simplify and optimize create_(system,env)_registry_keys().
parent
24eb38bd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
13 deletions
+15
-13
cpu.c
dlls/kernel32/cpu.c
+15
-13
No files found.
dlls/kernel32/cpu.c
View file @
0a66633c
...
...
@@ -132,7 +132,7 @@ static void create_system_registry_keys( const SYSTEM_INFO *info )
if
(
NtCreateKey
(
&
system_key
,
KEY_ALL_ACCESS
,
&
attr
,
0
,
NULL
,
0
,
NULL
))
return
;
RtlInitUnicodeString
(
&
valueW
,
IdentifierW
);
NtSetValueKey
(
system_key
,
&
valueW
,
0
,
REG_SZ
,
SysidW
,
(
strlenW
(
SysidW
)
+
1
)
*
sizeof
(
WCHAR
)
);
NtSetValueKey
(
system_key
,
&
valueW
,
0
,
REG_SZ
,
SysidW
,
sizeof
(
SysidW
)
);
attr
.
RootDirectory
=
system_key
;
RtlInitUnicodeString
(
&
nameW
,
fpuW
);
...
...
@@ -151,6 +151,7 @@ static void create_system_registry_keys( const SYSTEM_INFO *info )
if
(
!
NtCreateKey
(
&
hkey
,
KEY_ALL_ACCESS
,
&
attr
,
0
,
NULL
,
0
,
NULL
))
{
WCHAR
idW
[
60
];
DWORD
sizeW
;
DWORD
cpuMHz
=
cpuHz
/
1000000
;
/*TODO: report 64bit processors properly*/
...
...
@@ -158,12 +159,12 @@ static void create_system_registry_keys( const SYSTEM_INFO *info )
sprintf
(
id
,
"x86 Family %d Model %d Stepping %d"
,
info
->
wProcessorLevel
,
HIBYTE
(
info
->
wProcessorRevision
),
LOBYTE
(
info
->
wProcessorRevision
)
);
RtlMultiByteToUnicodeN
(
idW
,
sizeof
(
idW
),
NULL
,
id
,
strlen
(
id
)
+
1
);
NtSetValueKey
(
hkey
,
&
valueW
,
0
,
REG_SZ
,
idW
,
(
strlenW
(
idW
)
+
1
)
*
sizeof
(
WCHAR
)
);
RtlMultiByteToUnicodeN
(
idW
,
sizeof
(
idW
),
&
sizeW
,
id
,
strlen
(
id
)
+
1
);
NtSetValueKey
(
hkey
,
&
valueW
,
0
,
REG_SZ
,
idW
,
sizeW
);
/*TODO; report amd's properly*/
RtlInitUnicodeString
(
&
valueW
,
VendorIdentifierW
);
NtSetValueKey
(
hkey
,
&
valueW
,
0
,
REG_SZ
,
VenidIntelW
,
(
strlenW
(
VenidIntelW
)
+
1
)
*
sizeof
(
WCHAR
)
);
NtSetValueKey
(
hkey
,
&
valueW
,
0
,
REG_SZ
,
VenidIntelW
,
sizeof
(
VenidIntelW
)
);
RtlInitUnicodeString
(
&
valueW
,
mhzKeyW
);
NtSetValueKey
(
hkey
,
&
valueW
,
0
,
REG_DWORD
,
&
cpuMHz
,
sizeof
(
DWORD
)
);
...
...
@@ -194,6 +195,7 @@ static void create_env_registry_keys( const SYSTEM_INFO *info )
HANDLE
env_key
;
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
nameW
,
valueW
;
DWORD
sizeW
;
char
nProc
[
10
],
id
[
60
],
procLevel
[
10
],
rev
[
10
];
WCHAR
nProcW
[
10
],
idW
[
60
],
procLevelW
[
10
],
revW
[
10
];
...
...
@@ -214,31 +216,31 @@ static void create_env_registry_keys( const SYSTEM_INFO *info )
if
(
NtCreateKey
(
&
env_key
,
KEY_ALL_ACCESS
,
&
attr
,
0
,
NULL
,
0
,
NULL
))
return
;
sprintf
(
nProc
,
"%d"
,
info
->
dwNumberOfProcessors
);
RtlMultiByteToUnicodeN
(
nProcW
,
sizeof
(
nProcW
),
NULL
,
nProc
,
strlen
(
nProc
)
+
1
);
RtlMultiByteToUnicodeN
(
nProcW
,
sizeof
(
nProcW
),
&
sizeW
,
nProc
,
strlen
(
nProc
)
+
1
);
RtlInitUnicodeString
(
&
valueW
,
NumProcW
);
NtSetValueKey
(
env_key
,
&
valueW
,
0
,
REG_SZ
,
nProcW
,
(
strlenW
(
nProcW
)
+
1
)
*
sizeof
(
WCHAR
)
);
NtSetValueKey
(
env_key
,
&
valueW
,
0
,
REG_SZ
,
nProcW
,
sizeW
);
/* TODO: currently hardcoded x86, add different processors */
RtlInitUnicodeString
(
&
valueW
,
ProcArchW
);
NtSetValueKey
(
env_key
,
&
valueW
,
0
,
REG_SZ
,
x86W
,
(
strlenW
(
x86W
)
+
1
)
*
sizeof
(
WCHAR
)
);
NtSetValueKey
(
env_key
,
&
valueW
,
0
,
REG_SZ
,
x86W
,
sizeof
(
x86W
)
);
/* TODO: currently hardcoded Intel, add different processors */
sprintf
(
id
,
"x86 Family %d Model %d Stepping %d, GenuineIntel"
,
info
->
wProcessorLevel
,
HIBYTE
(
info
->
wProcessorRevision
),
LOBYTE
(
info
->
wProcessorRevision
)
);
RtlMultiByteToUnicodeN
(
idW
,
sizeof
(
idW
),
NULL
,
id
,
strlen
(
id
)
+
1
);
RtlMultiByteToUnicodeN
(
idW
,
sizeof
(
idW
),
&
sizeW
,
id
,
strlen
(
id
)
+
1
);
RtlInitUnicodeString
(
&
valueW
,
ProcIdW
);
NtSetValueKey
(
env_key
,
&
valueW
,
0
,
REG_SZ
,
idW
,
(
strlenW
(
idW
)
+
1
)
*
sizeof
(
WCHAR
)
);
NtSetValueKey
(
env_key
,
&
valueW
,
0
,
REG_SZ
,
idW
,
sizeW
);
sprintf
(
procLevel
,
"%d"
,
info
->
wProcessorLevel
);
RtlMultiByteToUnicodeN
(
procLevelW
,
sizeof
(
procLevelW
),
NULL
,
procLevel
,
strlen
(
procLevel
)
+
1
);
RtlMultiByteToUnicodeN
(
procLevelW
,
sizeof
(
procLevelW
),
&
sizeW
,
procLevel
,
strlen
(
procLevel
)
+
1
);
RtlInitUnicodeString
(
&
valueW
,
ProcLvlW
);
NtSetValueKey
(
env_key
,
&
valueW
,
0
,
REG_SZ
,
procLevelW
,
(
strlenW
(
procLevelW
)
+
1
)
*
sizeof
(
WCHAR
)
);
NtSetValueKey
(
env_key
,
&
valueW
,
0
,
REG_SZ
,
procLevelW
,
sizeW
);
/* Properly report model/stepping */
sprintf
(
rev
,
"%04x"
,
info
->
wProcessorRevision
);
RtlMultiByteToUnicodeN
(
revW
,
sizeof
(
revW
),
NULL
,
rev
,
strlen
(
rev
)
+
1
);
RtlMultiByteToUnicodeN
(
revW
,
sizeof
(
revW
),
&
sizeW
,
rev
,
strlen
(
rev
)
+
1
);
RtlInitUnicodeString
(
&
valueW
,
ProcRevW
);
NtSetValueKey
(
env_key
,
&
valueW
,
0
,
REG_SZ
,
revW
,
(
strlenW
(
revW
)
+
1
)
*
sizeof
(
WCHAR
)
);
NtSetValueKey
(
env_key
,
&
valueW
,
0
,
REG_SZ
,
revW
,
sizeW
);
NtClose
(
env_key
);
}
...
...
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