Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
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 )
...
@@ -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
;
if
(
NtCreateKey
(
&
system_key
,
KEY_ALL_ACCESS
,
&
attr
,
0
,
NULL
,
0
,
NULL
))
return
;
RtlInitUnicodeString
(
&
valueW
,
IdentifierW
);
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
;
attr
.
RootDirectory
=
system_key
;
RtlInitUnicodeString
(
&
nameW
,
fpuW
);
RtlInitUnicodeString
(
&
nameW
,
fpuW
);
...
@@ -151,6 +151,7 @@ static void create_system_registry_keys( const SYSTEM_INFO *info )
...
@@ -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
))
if
(
!
NtCreateKey
(
&
hkey
,
KEY_ALL_ACCESS
,
&
attr
,
0
,
NULL
,
0
,
NULL
))
{
{
WCHAR
idW
[
60
];
WCHAR
idW
[
60
];
DWORD
sizeW
;
DWORD
cpuMHz
=
cpuHz
/
1000000
;
DWORD
cpuMHz
=
cpuHz
/
1000000
;
/*TODO: report 64bit processors properly*/
/*TODO: report 64bit processors properly*/
...
@@ -158,12 +159,12 @@ static void create_system_registry_keys( const SYSTEM_INFO *info )
...
@@ -158,12 +159,12 @@ static void create_system_registry_keys( const SYSTEM_INFO *info )
sprintf
(
id
,
"x86 Family %d Model %d Stepping %d"
,
sprintf
(
id
,
"x86 Family %d Model %d Stepping %d"
,
info
->
wProcessorLevel
,
HIBYTE
(
info
->
wProcessorRevision
),
LOBYTE
(
info
->
wProcessorRevision
)
);
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
);
NtSetValueKey
(
hkey
,
&
valueW
,
0
,
REG_SZ
,
idW
,
(
strlenW
(
idW
)
+
1
)
*
sizeof
(
WCHAR
)
);
NtSetValueKey
(
hkey
,
&
valueW
,
0
,
REG_SZ
,
idW
,
sizeW
);
/*TODO; report amd's properly*/
/*TODO; report amd's properly*/
RtlInitUnicodeString
(
&
valueW
,
VendorIdentifierW
);
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
);
RtlInitUnicodeString
(
&
valueW
,
mhzKeyW
);
NtSetValueKey
(
hkey
,
&
valueW
,
0
,
REG_DWORD
,
&
cpuMHz
,
sizeof
(
DWORD
)
);
NtSetValueKey
(
hkey
,
&
valueW
,
0
,
REG_DWORD
,
&
cpuMHz
,
sizeof
(
DWORD
)
);
...
@@ -194,6 +195,7 @@ static void create_env_registry_keys( const SYSTEM_INFO *info )
...
@@ -194,6 +195,7 @@ static void create_env_registry_keys( const SYSTEM_INFO *info )
HANDLE
env_key
;
HANDLE
env_key
;
OBJECT_ATTRIBUTES
attr
;
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
nameW
,
valueW
;
UNICODE_STRING
nameW
,
valueW
;
DWORD
sizeW
;
char
nProc
[
10
],
id
[
60
],
procLevel
[
10
],
rev
[
10
];
char
nProc
[
10
],
id
[
60
],
procLevel
[
10
],
rev
[
10
];
WCHAR
nProcW
[
10
],
idW
[
60
],
procLevelW
[
10
],
revW
[
10
];
WCHAR
nProcW
[
10
],
idW
[
60
],
procLevelW
[
10
],
revW
[
10
];
...
@@ -214,31 +216,31 @@ static void create_env_registry_keys( const SYSTEM_INFO *info )
...
@@ -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
;
if
(
NtCreateKey
(
&
env_key
,
KEY_ALL_ACCESS
,
&
attr
,
0
,
NULL
,
0
,
NULL
))
return
;
sprintf
(
nProc
,
"%d"
,
info
->
dwNumberOfProcessors
);
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
);
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 */
/* TODO: currently hardcoded x86, add different processors */
RtlInitUnicodeString
(
&
valueW
,
ProcArchW
);
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 */
/* TODO: currently hardcoded Intel, add different processors */
sprintf
(
id
,
"x86 Family %d Model %d Stepping %d, GenuineIntel"
,
sprintf
(
id
,
"x86 Family %d Model %d Stepping %d, GenuineIntel"
,
info
->
wProcessorLevel
,
HIBYTE
(
info
->
wProcessorRevision
),
LOBYTE
(
info
->
wProcessorRevision
)
);
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
);
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
);
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
);
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 */
/* Properly report model/stepping */
sprintf
(
rev
,
"%04x"
,
info
->
wProcessorRevision
);
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
);
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
);
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