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
ed1b527d
Commit
ed1b527d
authored
Jun 12, 2009
by
Detlef Riekenberg
Committed by
Alexandre Julliard
Jun 15, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setupapi: Move IsUserAdmin to shell32.IsUserAnAdmin.
parent
fb984990
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
65 deletions
+74
-65
misc.c
dlls/setupapi/misc.c
+2
-60
shell32.spec
dlls/shell32/shell32.spec
+1
-1
shellord.c
dlls/shell32/shellord.c
+70
-4
shlobj.h
include/shlobj.h
+1
-0
No files found.
dlls/setupapi/misc.c
View file @
ed1b527d
...
...
@@ -30,6 +30,7 @@
#include "lzexpand.h"
#include "softpub.h"
#include "mscat.h"
#include "shlobj.h"
#include "wine/unicode.h"
#include "wine/debug.h"
...
...
@@ -197,67 +198,8 @@ LONG WINAPI QueryRegistryValue(HKEY hKey,
*/
BOOL
WINAPI
IsUserAdmin
(
VOID
)
{
SID_IDENTIFIER_AUTHORITY
Authority
=
{
SECURITY_NT_AUTHORITY
};
HANDLE
hToken
;
DWORD
dwSize
;
PTOKEN_GROUPS
lpGroups
;
PSID
lpSid
;
DWORD
i
;
BOOL
bResult
=
FALSE
;
TRACE
(
"
\n
"
);
if
(
!
OpenProcessToken
(
GetCurrentProcess
(),
TOKEN_QUERY
,
&
hToken
))
{
return
FALSE
;
}
if
(
!
GetTokenInformation
(
hToken
,
TokenGroups
,
NULL
,
0
,
&
dwSize
))
{
if
(
GetLastError
()
!=
ERROR_INSUFFICIENT_BUFFER
)
{
CloseHandle
(
hToken
);
return
FALSE
;
}
}
lpGroups
=
MyMalloc
(
dwSize
);
if
(
lpGroups
==
NULL
)
{
CloseHandle
(
hToken
);
return
FALSE
;
}
if
(
!
GetTokenInformation
(
hToken
,
TokenGroups
,
lpGroups
,
dwSize
,
&
dwSize
))
{
MyFree
(
lpGroups
);
CloseHandle
(
hToken
);
return
FALSE
;
}
CloseHandle
(
hToken
);
if
(
!
AllocateAndInitializeSid
(
&
Authority
,
2
,
SECURITY_BUILTIN_DOMAIN_RID
,
DOMAIN_ALIAS_RID_ADMINS
,
0
,
0
,
0
,
0
,
0
,
0
,
&
lpSid
))
{
MyFree
(
lpGroups
);
return
FALSE
;
}
for
(
i
=
0
;
i
<
lpGroups
->
GroupCount
;
i
++
)
{
if
(
EqualSid
(
lpSid
,
lpGroups
->
Groups
[
i
].
Sid
))
{
bResult
=
TRUE
;
break
;
}
}
FreeSid
(
lpSid
);
MyFree
(
lpGroups
);
return
bResult
;
return
IsUserAnAdmin
();
}
...
...
dlls/shell32/shell32.spec
View file @
ed1b527d
...
...
@@ -251,7 +251,7 @@
654 stdcall @(long long) shell32_654 # ReadCabinetState@8
660 stdcall -noname FileIconInit(long)
680 stdcall -noname IsUserAdmin()
680 stdcall -noname IsUserA
nA
dmin()
704 stdcall -noname GUIDFromStringW(wstr ptr)
...
...
dlls/shell32/shellord.c
View file @
ed1b527d
...
...
@@ -1279,13 +1279,79 @@ BOOL WINAPI FileIconInit(BOOL bFullInit)
{
FIXME
(
"(%s)
\n
"
,
bFullInit
?
"true"
:
"false"
);
return
0
;
}
/*************************************************************************
* IsUserAdmin [SHELL32.680] NT 4.0
* IsUserAnAdmin [SHELL32.680] NT 4.0
*
* Checks whether the current user is a member of the Administrators group.
*
* PARAMS
* None
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*/
HRESULT
WINAPI
IsUserAdmin
(
void
)
{
FIXME
(
"stub
\n
"
);
return
TRUE
;
BOOL
WINAPI
IsUserAnAdmin
(
VOID
)
{
SID_IDENTIFIER_AUTHORITY
Authority
=
{
SECURITY_NT_AUTHORITY
};
HANDLE
hToken
;
DWORD
dwSize
;
PTOKEN_GROUPS
lpGroups
;
PSID
lpSid
;
DWORD
i
;
BOOL
bResult
=
FALSE
;
TRACE
(
"
\n
"
);
if
(
!
OpenProcessToken
(
GetCurrentProcess
(),
TOKEN_QUERY
,
&
hToken
))
{
return
FALSE
;
}
if
(
!
GetTokenInformation
(
hToken
,
TokenGroups
,
NULL
,
0
,
&
dwSize
))
{
if
(
GetLastError
()
!=
ERROR_INSUFFICIENT_BUFFER
)
{
CloseHandle
(
hToken
);
return
FALSE
;
}
}
lpGroups
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwSize
);
if
(
lpGroups
==
NULL
)
{
CloseHandle
(
hToken
);
return
FALSE
;
}
if
(
!
GetTokenInformation
(
hToken
,
TokenGroups
,
lpGroups
,
dwSize
,
&
dwSize
))
{
HeapFree
(
GetProcessHeap
(),
0
,
lpGroups
);
CloseHandle
(
hToken
);
return
FALSE
;
}
CloseHandle
(
hToken
);
if
(
!
AllocateAndInitializeSid
(
&
Authority
,
2
,
SECURITY_BUILTIN_DOMAIN_RID
,
DOMAIN_ALIAS_RID_ADMINS
,
0
,
0
,
0
,
0
,
0
,
0
,
&
lpSid
))
{
HeapFree
(
GetProcessHeap
(),
0
,
lpGroups
);
return
FALSE
;
}
for
(
i
=
0
;
i
<
lpGroups
->
GroupCount
;
i
++
)
{
if
(
EqualSid
(
lpSid
,
lpGroups
->
Groups
[
i
].
Sid
))
{
bResult
=
TRUE
;
break
;
}
}
FreeSid
(
lpSid
);
HeapFree
(
GetProcessHeap
(),
0
,
lpGroups
);
return
bResult
;
}
/*************************************************************************
...
...
include/shlobj.h
View file @
ed1b527d
...
...
@@ -77,6 +77,7 @@ VOID WINAPI SHUpdateImageW(LPCWSTR,INT,UINT,INT);
#define SHUpdateImage WINELIB_NAME_AW(SHUpdateImage)
int
WINAPI
RestartDialog
(
HWND
,
LPCWSTR
,
DWORD
);
int
WINAPI
RestartDialogEx
(
HWND
,
LPCWSTR
,
DWORD
,
DWORD
);
BOOL
WINAPI
IsUserAnAdmin
(
void
);
#define SHFMT_ERROR 0xFFFFFFFFL
/* Error on last format, drive may be formattable */
#define SHFMT_CANCEL 0xFFFFFFFEL
/* Last format was cancelled */
...
...
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