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
93cb78f3
Commit
93cb78f3
authored
Jan 21, 2006
by
James Hawkins
Committed by
Alexandre Julliard
Jan 21, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advpack: Implement IsNTAdmin.
parent
51fd7507
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
6 deletions
+58
-6
Makefile.in
dlls/advpack/Makefile.in
+1
-1
advpack.c
dlls/advpack/advpack.c
+57
-5
No files found.
dlls/advpack/Makefile.in
View file @
93cb78f3
...
...
@@ -4,7 +4,7 @@ SRCDIR = @srcdir@
VPATH
=
@srcdir@
MODULE
=
advpack.dll
IMPORTLIB
=
libadvpack.
$(IMPLIBEXT)
IMPORTS
=
setupapi version user32 kernel32 ntdll
IMPORTS
=
setupapi version user32
advapi32
kernel32 ntdll
EXTRALIBS
=
$(LIBUNICODE)
C_SRCS
=
\
...
...
dlls/advpack/advpack.c
View file @
93cb78f3
...
...
@@ -221,14 +221,66 @@ HRESULT WINAPI DoInfInstall(const SETUPCOMMAND_PARAMS *setup)
*
* RETURNS
* TRUE if user has admin rights, FALSE otherwise.
*
* BUGS
* Unimplemented.
*/
BOOL
WINAPI
IsNTAdmin
(
DWORD
reserved
,
LPDWORD
pReserved
)
{
FIXME
(
"(0x%08lx, %p): stub
\n
"
,
reserved
,
pReserved
);
return
TRUE
;
SID_IDENTIFIER_AUTHORITY
SidAuthority
=
{
SECURITY_NT_AUTHORITY
};
PTOKEN_GROUPS
pTokenGroups
;
BOOL
bSidFound
=
FALSE
;
DWORD
dwSize
,
i
;
HANDLE
hToken
;
PSID
pSid
;
TRACE
(
"(0x%08lx, %p)
\n
"
,
reserved
,
pReserved
);
if
(
!
OpenProcessToken
(
GetCurrentProcess
(),
TOKEN_QUERY
,
&
hToken
))
return
FALSE
;
if
(
!
GetTokenInformation
(
hToken
,
TokenGroups
,
NULL
,
0
,
&
dwSize
))
{
if
(
GetLastError
()
!=
ERROR_INSUFFICIENT_BUFFER
)
{
CloseHandle
(
hToken
);
return
FALSE
;
}
}
pTokenGroups
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwSize
);
if
(
!
pTokenGroups
)
{
CloseHandle
(
hToken
);
return
FALSE
;
}
if
(
!
GetTokenInformation
(
hToken
,
TokenGroups
,
pTokenGroups
,
dwSize
,
&
dwSize
))
{
HeapFree
(
GetProcessHeap
(),
0
,
pTokenGroups
);
CloseHandle
(
hToken
);
return
FALSE
;
}
CloseHandle
(
hToken
);
if
(
!
AllocateAndInitializeSid
(
&
SidAuthority
,
2
,
SECURITY_BUILTIN_DOMAIN_RID
,
DOMAIN_ALIAS_RID_ADMINS
,
0
,
0
,
0
,
0
,
0
,
0
,
&
pSid
))
{
HeapFree
(
GetProcessHeap
(),
0
,
pTokenGroups
);
return
FALSE
;
}
for
(
i
=
0
;
i
<
pTokenGroups
->
GroupCount
;
i
++
)
{
if
(
EqualSid
(
pSid
,
pTokenGroups
->
Groups
[
i
].
Sid
))
{
bSidFound
=
TRUE
;
break
;
}
}
HeapFree
(
GetProcessHeap
(),
0
,
pTokenGroups
);
FreeSid
(
pSid
);
return
bSidFound
;
}
/***********************************************************************
...
...
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