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
9d435046
Commit
9d435046
authored
Jul 31, 2006
by
Robert Reif
Committed by
Alexandre Julliard
Jul 31, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: Add more helper functions.
Add ADVAPI_GetComputerSid.
parent
e10f5b1d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
0 deletions
+38
-0
advapi32_misc.h
dlls/advapi32/advapi32_misc.h
+1
-0
security.c
dlls/advapi32/security.c
+37
-0
No files found.
dlls/advapi32/advapi32_misc.h
View file @
9d435046
...
...
@@ -22,5 +22,6 @@
const
char
*
debugstr_sid
(
PSID
sid
);
BOOL
ADVAPI_IsLocalComputer
(
LPCWSTR
ServerName
);
BOOL
ADVAPI_GetComputerSid
(
PSID
sid
);
#endif
/* __WINE_ADVAPI32MISC_H */
dlls/advapi32/security.c
View file @
9d435046
...
...
@@ -342,6 +342,43 @@ BOOL ADVAPI_IsLocalComputer(LPCWSTR ServerName)
return
Result
;
}
/************************************************************
* ADVAPI_GetComputerSid
*
* Reads the computer SID from the registry.
*/
BOOL
ADVAPI_GetComputerSid
(
PSID
sid
)
{
HKEY
key
;
LONG
ret
;
if
((
ret
=
RegOpenKeyExA
(
HKEY_LOCAL_MACHINE
,
"SECURITY
\\
SAM
\\
Domains
\\
Account"
,
0
,
KEY_READ
,
&
key
))
==
ERROR_SUCCESS
)
{
static
const
WCHAR
V
[]
=
{
'V'
,
0
};
DWORD
size
=
0
;
ret
=
RegQueryValueExW
(
key
,
V
,
NULL
,
NULL
,
NULL
,
&
size
);
if
(
ret
==
ERROR_MORE_DATA
||
ret
==
ERROR_SUCCESS
)
{
BYTE
*
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
data
)
{
if
((
ret
=
RegQueryValueExW
(
key
,
V
,
NULL
,
NULL
,
data
,
&
size
))
==
ERROR_SUCCESS
)
{
/* the SID is in the last 24 bytes of the binary data */
CopyMemory
(
sid
,
&
data
[
size
-
24
],
24
);
return
TRUE
;
}
}
}
RegCloseKey
(
key
);
}
return
FALSE
;
}
/* ##############################
###### TOKEN FUNCTIONS ######
##############################
...
...
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