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
38d33e33
Commit
38d33e33
authored
Sep 21, 2006
by
Huw Davies
Committed by
Alexandre Julliard
Sep 25, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: Fix ADVAPI_GetComputerSid to work correctly if a sid doesn't exist in the registry.
This makes the tests run correctly on first invocation.
parent
7dbda7a9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
9 deletions
+7
-9
security.c
dlls/advapi32/security.c
+7
-9
No files found.
dlls/advapi32/security.c
View file @
38d33e33
...
...
@@ -386,6 +386,7 @@ BOOL ADVAPI_GetComputerSid(PSID sid)
{
HKEY
key
;
LONG
ret
;
BOOL
retval
=
FALSE
;
static
const
WCHAR
Account
[]
=
{
'S'
,
'E'
,
'C'
,
'U'
,
'R'
,
'I'
,
'T'
,
'Y'
,
'\\'
,
'S'
,
'A'
,
'M'
,
'\\'
,
'D'
,
'o'
,
'm'
,
'a'
,
'i'
,
'n'
,
's'
,
'\\'
,
'A'
,
'c'
,
'c'
,
'o'
,
'u'
,
'n'
,
't'
,
0
};
static
const
WCHAR
V
[]
=
{
'V'
,
0
};
...
...
@@ -404,9 +405,7 @@ BOOL ADVAPI_GetComputerSid(PSID sid)
{
/* the SID is in the last 24 bytes of the binary data */
CopyMemory
(
sid
,
&
data
[
size
-
24
],
24
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
RegCloseKey
(
key
);
return
TRUE
;
retval
=
TRUE
;
}
HeapFree
(
GetProcessHeap
(),
0
,
data
);
}
...
...
@@ -414,6 +413,8 @@ BOOL ADVAPI_GetComputerSid(PSID sid)
RegCloseKey
(
key
);
}
if
(
retval
==
TRUE
)
return
retval
;
/* create a new random SID */
if
(
RegCreateKeyExW
(
HKEY_LOCAL_MACHINE
,
Account
,
0
,
NULL
,
0
,
KEY_ALL_ACCESS
,
NULL
,
&
key
,
NULL
)
==
ERROR_SUCCESS
)
...
...
@@ -427,18 +428,15 @@ BOOL ADVAPI_GetComputerSid(PSID sid)
if
(
AllocateAndInitializeSid
(
&
identifierAuthority
,
4
,
SECURITY_NT_NON_UNIQUE
,
id
[
0
],
id
[
1
],
id
[
2
],
0
,
0
,
0
,
0
,
&
new_sid
))
{
if
(
RegSetValueExW
(
key
,
V
,
0
,
REG_BINARY
,
new_sid
,
GetLengthSid
(
new_sid
))
==
ERROR_SUCCESS
)
{
FreeSid
(
new_sid
);
RegCloseKey
(
key
);
return
CopySid
(
GetLengthSid
(
new_sid
),
sid
,
&
new_sid
);
}
retval
=
CopySid
(
GetLengthSid
(
new_sid
),
sid
,
new_sid
);
FreeSid
(
new_sid
);
}
}
RegCloseKey
(
key
);
}
return
FALSE
;
return
retval
;
}
/* ##############################
...
...
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